﻿
using Aspose.Cells;
using Aspose.Cells.Charts;
using Bentley.CifNET.GeometryModel;
using Bentley.CifNET.GeometryModel.SDK;
using Bentley.CifNET.LinearGeometry;
using Bentley.CifNET.Model;
using Bentley.CifNET.Objects;
using Bentley.CifNET.Objects.DataAccess;
using Bentley.CifNET.SDK.Edit;
using Bentley.DgnPlatformNET.Elements;
using Bentley.GeometryNET;
using Bentley.GeometryNET.Common;
using Bentley.Interop.MicroStationDGN;
using BoxCulvert.entity;
using BoxCulvert.service.cave;
using BoxCulvert.view;
using Checc.Culvert.LayingLine;
using Checc_CircularCulvert_Assemble.structures;
using Checc_CircularCulvert_Assemble.structures.aliform;
using CheccConicalSlope;
using CheccCoverplateCulvertAssemble.Common;
using CheccCoverplateCulvertAssemble.Common.Http;
using CheccCoverplateCulvertAssemble.Common.Total;
using CheccCoverplateCulvertAssemble.Conmmon;
using CheccCoverplateCulvertAssemble.Entity;
using CheccCoverplateCulvertAssemble.Operation;
using CheccCoverplateCulvertAssemble.Operation.dynamic;
using CheccCoverplateCulvertAssemble.Operation.section;
using CheccCoverplateCulvertAssemble.run;
using CheccCoverplateCulvertAssemble.SlabCulvert;
using CheccCoverplateCulvertAssemble.Tools;
using CheccCoverplateCulvertAssemble.util;
using CheccFillTheChute.Operation;
using CheccFillTheChute.Tools;
using CheccTexturePropertyGive;
using CulvertInitializationDatas;
using Newtonsoft.Json;
using System;
using BIM = Bentley.Interop.MicroStationDGN;
using BMI = Bentley.MstnPlatformNET.InteropServices;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Xml;
using TemplateStandardLibrary.src.Operation.LD;
using 平交口设计.solid;
using static CheccTexturePropertyGive.SetCoverCulvertTexture;
using Element = Bentley.DgnPlatformNET.Elements.Element;
using EndWall = CheccCoverplateCulvertAssemble.Common.Http.EndWall;
using Bentley.DgnPlatformNET;
using System.Runtime.ConstrainedExecution;

namespace CheccCoverplateCulvertAssemble.FormColl
{
    public partial class Assemble : Form
    {
        // 默认是涵洞 默认选择的否 
        bool isAisle = false;

        /// <summary>
        /// 工程数量表
        /// </summary>
        public static Coverplate_Culvert_CountSheetEntity culvertCalculateTable { get; set; }
        public enum InclinedPlate
        {
            /// <summary>
            /// 左侧
            /// </summary>
            Left,
            /// <summary>
            /// 右侧
            /// </summary>
            Right
        }

        public ConstructionScheme constructionScheme { get; set; }
        /// <summary>
        /// 施工方案
        /// </summary>
        public enum ConstructionScheme
        {
            /// <summary>
            /// 现浇
            /// </summary>
            CastInPlace = 0,
            /// <summary>
            /// 预制
            /// </summary>
            Precast,
        }
        /// <summary>
        /// 涵洞类型
        /// </summary>
        public enum CulvertFoundationType
        {
            /// <summary>
            /// 正盖板
            /// </summary>
            FrontCover = 0,
            /// <summary>
            /// 斜盖板
            /// </summary>
            InclinedCover,
        }

        public BaseType baseType { get; set; }

        /// <summary>
        /// 基础类型
        /// </summary>
        public enum BaseType
        {
            /// <summary>
            /// 整体式
            /// </summary>
            Monolithic = 0,
            /// <summary>
            /// 分离式
            /// </summary>
            Detached,
        }

        #region 默认数据变量
        /// <summary>
        /// 洞口构造洞口数据
        /// </summary>
        List<string> OverallEntranceCaveDatas = new List<string>()
        {
            "八字墙",
            "锥坡"
            //"边沟跌井",
            //"出口急流槽",
            //"跌水",
            //"进口急流槽",
            //"跌水井",
            //"排水槽"
        };
        List<string> settingAndNo = new List<string>() { "设置", "不设" };

        Dictionary<string, ReplaceMentEntity> replaceMent = new Dictionary<string, ReplaceMentEntity>();
        #endregion
        public Assemble()
        {
            #region 界面设置
            //使最大化窗口失效
            this.MaximizeBox = false;
            //禁止对窗口大小进行拖拽
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
            //窗口位置
            this.StartPosition = FormStartPosition.CenterScreen;
            //窗口置顶
            this.TopMost = true;
            #endregion
            InitializeComponent();

            this.cmb_CoverplateType.SelectedIndex = 0;
            this.cmb_BasicsType.SelectedIndex = 0;

            this.Icon = Properties.Resources.Culvert;
            //窗体控件适应屏幕分辨率
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
            this.cmb_ExchangeFillMaterial.Items.Add("砂砾");
            this.cmb_ExchangeFillMaterial.Items.Add("碎石");
            this.cmb_ExchangeFillMaterial.Items.Add("石灰土");
            //洞口构造初始
            this.cmb_LeftCave.DataSource = new List<string>(OverallEntranceCaveDatas);
            this.cmb_RightCave.DataSource = new List<string>(OverallEntranceCaveDatas);
            #region 总体
            this.cbx_isUse.DataBindings.Add("Text", CommonData.Instance.CommomTotal, "WhetherGeneralDiagram", true, DataSourceUpdateMode.OnPropertyChanged);
            this.cmb_StandardDrawing.DataBindings.Add("Text", CommonData.Instance.CommomTotal, "GeneralDiagram", true, DataSourceUpdateMode.OnPropertyChanged);
            this.cmb_CoverplateType.DataBindings.Add("Text", CommonData.Instance.CommomTotal, "CoverPlateType", true, DataSourceUpdateMode.OnPropertyChanged);
            this.cmb_BasicsType.DataBindings.Add("Text", CommonData.Instance.CommomTotal, "BaseType", true, DataSourceUpdateMode.OnPropertyChanged);
            //涵洞填土高度
            this.txt_Fill.DataBindings.Add("Text", CommonData.Instance.CommomTotal, "FillValue", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_FillLeft.DataBindings.Add("Text", CommonData.Instance.CommomTotal, "LeftFillValue", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_FillRight.DataBindings.Add("Text", CommonData.Instance.CommomTotal, "RightFillValue", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_CulvertBaseHeight.DataBindings.Add("Text", CommonData.Instance.CommomTotal, "Elevation", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_CulvertBaseSlope.DataBindings.Add("Text", CommonData.Instance.CommomTotal, "Slope", true, DataSourceUpdateMode.OnPropertyChanged);

            this.txt_LeftCulverLength.DataBindings.Add("Text", CommonData.Instance.CommomTotal, "LeftLength", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_RightCulverLength.DataBindings.Add("Text", CommonData.Instance.CommomTotal, "RightLength", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_LeftCaveAngle.DataBindings.Add("Text", CommonData.Instance.CommomTotal, "leftAngle", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_RightCaveAngle.DataBindings.Add("Text", CommonData.Instance.CommomTotal, "rightAngle", true, DataSourceUpdateMode.OnPropertyChanged);

            this.cmb_LeftCave.DataBindings.Add("Text", CommonData.Instance.CommomTotal.EntranceToCave.Left, "Type", true, DataSourceUpdateMode.OnPropertyChanged);
            this.cmb_RightCave.DataBindings.Add("Text", CommonData.Instance.CommomTotal.EntranceToCave.Right, "Type", true, DataSourceUpdateMode.OnPropertyChanged);
            //净跨净高
            this.cmb_ClearSpanAndHeight.DataBindings.Add("Text", CommonData.Instance.CommomTotal, "ClearSpanHeadroom", true, DataSourceUpdateMode.OnPropertyChanged);

            CommonData.Instance.CommomTotal.EntranceToCave.Left.Type = this.cmb_LeftCave.Text;
            CommonData.Instance.CommomTotal.EntranceToCave.Right.Type = this.cmb_RightCave.Text;
            CommonData.Instance.CommomTotal.BaseType = this.cmb_BasicsType.Text;
            CommonData.Instance.CommomTotal.CoverPlateType = this.cmb_CoverplateType.Text;
            #endregion

            #region 界面绑定
            #region 涵身

            #endregion
            #region 涵长分段信息
            this.txt_OverHeightIn.DataBindings.Add("Text", CommonData.Instance.CommonCulvertLengthSet, "OverHeightIn", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_ExtensionOut.DataBindings.Add("Text", CommonData.Instance.CommonCulvertLengthSet, "ExtensionOut", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_OverHeightOut.DataBindings.Add("Text", CommonData.Instance.CommonCulvertLengthSet, "OverHeightOut", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_MinDistance.DataBindings.Add("Text", CommonData.Instance.CommonCulvertLengthSet, "MinDistance", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_MaxDistance.DataBindings.Add("Text", CommonData.Instance.CommonCulvertLengthSet, "MaxDistance", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_SedimentationWidth.DataBindings.Add("Text", CommonData.Instance.CommonCulvertLengthSet, "SedimentationWidth", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_BaseWidth.DataBindings.Add("Text", CommonData.Instance.CommonCulvertLengthSet, "BaseWidth", true, DataSourceUpdateMode.OnPropertyChanged);
            #endregion
            #region 盖板
            //正盖板
            this.txt_Length.DataBindings.Add("Text", CommonData.Instance.CoverPlateParameter.FrontPlate, "Length", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_width.DataBindings.Add("Text", CommonData.Instance.CoverPlateParameter.FrontPlate, "Width", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_PointPly.DataBindings.Add("Text", CommonData.Instance.CoverPlateParameter.FrontPlate, "FulcrumThickness", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_MidSpanPly.DataBindings.Add("Text", CommonData.Instance.CoverPlateParameter.FrontPlate, "MidspanThickness", true, DataSourceUpdateMode.OnPropertyChanged);
            this.cmb_ProtectiveLayer.DataBindings.Add("Text", CommonData.Instance.CoverPlateParameter.FrontPlate, "NetProtectiveLayer", true, DataSourceUpdateMode.OnPropertyChanged);
            this.cmb_CoverplateModel.DataBindings.Add("Text", CommonData.Instance.CoverPlateParameter.FrontPlate, "StandardPlateModel", true, DataSourceUpdateMode.OnPropertyChanged);
            //左斜盖板
            this.txt_LeftLength.DataBindings.Add("Text", CommonData.Instance.CoverPlateParameter.LeftInclinedPlate, "Length", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_LeftShortLength.DataBindings.Add("Text", CommonData.Instance.CoverPlateParameter.LeftInclinedPlate, "ShortSideLength", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_LeftLongLength.DataBindings.Add("Text", CommonData.Instance.CoverPlateParameter.LeftInclinedPlate, "LongSideLength", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_LeftCoverplatePly.DataBindings.Add("Text", CommonData.Instance.CoverPlateParameter.LeftInclinedPlate, "Thickness", true, DataSourceUpdateMode.OnPropertyChanged);
            this.cmb_LeftProtectiveLayer.DataBindings.Add("Text", CommonData.Instance.CoverPlateParameter.LeftInclinedPlate, "NetProtectiveLayer", true, DataSourceUpdateMode.OnPropertyChanged);
            this.cmb_LeftCoverplateModel.DataBindings.Add("Text", CommonData.Instance.CoverPlateParameter.LeftInclinedPlate, "StandardPlateModel", true, DataSourceUpdateMode.OnPropertyChanged);
            //右斜盖板
            this.txt_RightLength.DataBindings.Add("Text", CommonData.Instance.CoverPlateParameter.RightInclinedPlate, "Length", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_RightShortLength.DataBindings.Add("Text", CommonData.Instance.CoverPlateParameter.RightInclinedPlate, "ShortSideLength", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_RightLongLength.DataBindings.Add("Text", CommonData.Instance.CoverPlateParameter.RightInclinedPlate, "LongSideLength", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_RightCoverplatePly.DataBindings.Add("Text", CommonData.Instance.CoverPlateParameter.RightInclinedPlate, "Thickness", true, DataSourceUpdateMode.OnPropertyChanged);
            this.cmb_RightProtectiveLayer.DataBindings.Add("Text", CommonData.Instance.CoverPlateParameter.RightInclinedPlate, "NetProtectiveLayer", true, DataSourceUpdateMode.OnPropertyChanged);
            this.cmb_RightCoverplateModel.DataBindings.Add("Text", CommonData.Instance.CoverPlateParameter.RightInclinedPlate, "StandardPlateModel", true, DataSourceUpdateMode.OnPropertyChanged);
            //沉降缝
            this.txt_FillingMaterial.DataBindings.Add("Text", CommonData.Instance.CoverPlateParameter.SettlementJoint, "FillMaterial", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_MainMaterial.DataBindings.Add("Text", CommonData.Instance.CoverPlateParameter.SettlementJoint, "MainWrappingMaterial", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_InternalPacking.DataBindings.Add("Text", CommonData.Instance.CoverPlateParameter.SettlementJoint, "InternalPacking", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_ProtectiveLayer.DataBindings.Add("Text", CommonData.Instance.CoverPlateParameter.SettlementJoint, "UpperProtectiveLayer", true, DataSourceUpdateMode.OnPropertyChanged);
            #endregion
            #region 帽石
            //左帽石
            this.txt_LeftCapStoneWidth.DataBindings.Add("Text", CommonData.Instance.CapStone.CapStoneLeft, "Width", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_LeftCapStoneChamfering.DataBindings.Add("Text", CommonData.Instance.CapStone.CapStoneLeft, "Chamfering", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_LeftCapStoneHeight.DataBindings.Add("Text", CommonData.Instance.CapStone.CapStoneLeft, "Height", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_LeftCapStoneOutQuantity.DataBindings.Add("Text", CommonData.Instance.CapStone.CapStoneLeft, "OutQuantity", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_LeftCapStoneMaterial.DataBindings.Add("Text", CommonData.Instance.CapStone.CapStoneLeft, "Material", true, DataSourceUpdateMode.OnPropertyChanged);
            //右帽石
            this.txt_RightCapStoneWidth.DataBindings.Add("Text", CommonData.Instance.CapStone.CapStoneRight, "Width", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_RightCapStoneChamfering.DataBindings.Add("Text", CommonData.Instance.CapStone.CapStoneRight, "Chamfering", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_RightCapStoneHeight.DataBindings.Add("Text", CommonData.Instance.CapStone.CapStoneRight, "Height", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_RightCapStoneOutQuantity.DataBindings.Add("Text", CommonData.Instance.CapStone.CapStoneRight, "OutQuantity", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_RightCapStoneMaterial.DataBindings.Add("Text", CommonData.Instance.CapStone.CapStoneRight, "Material", true, DataSourceUpdateMode.OnPropertyChanged);
            #endregion
            #region 端墙
            //左侧参数
            this.cmb_LeftEndWallBackSlope.DataBindings.Add("Text", CommonData.Instance.EndWall.EndWallLeft, "Slope", true, DataSourceUpdateMode.OnPropertyChanged);
            this.cmb_LeftEndWallBaseBurialDepth.DataBindings.Add("Text", CommonData.Instance.EndWall.EndWallLeft, "BaseBurialDepth", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_LeftEndWallHeight.DataBindings.Add("Text", CommonData.Instance.EndWall.EndWallLeft, "Height", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_LeftEndWallBaseNumberOfPlies.DataBindings.Add("Text", CommonData.Instance.EndWall.EndWallLeft, "BaseNumberOfPlies", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_LeftEndWallBaseHeight.DataBindings.Add("Text", CommonData.Instance.EndWall.EndWallLeft, "BaseHeight", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_LeftEndWallWidth.DataBindings.Add("Text", CommonData.Instance.EndWall.EndWallLeft, "Width", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_LeftEndWallOverhang.DataBindings.Add("Text", CommonData.Instance.EndWall.EndWallLeft, "Overhang", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_LeftEndWallEdgeIns.DataBindings.Add("Text", CommonData.Instance.EndWall.EndWallLeft, "EdgeIn", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_LeftEndWallEdgeOut.DataBindings.Add("Text", CommonData.Instance.EndWall.EndWallLeft, "EdgeOut", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_LeftEndWallOneMaterial.DataBindings.Add("Text", CommonData.Instance.EndWall.EndWallLeft, "Material", true, DataSourceUpdateMode.OnPropertyChanged);
            //右侧参数
            this.cmb_RightEndWallBackSlope.DataBindings.Add("Text", CommonData.Instance.EndWall.EndWallRight, "Slope", true, DataSourceUpdateMode.OnPropertyChanged);
            this.cmb_RightEndWallBaseBurialDepth.DataBindings.Add("Text", CommonData.Instance.EndWall.EndWallRight, "BaseBurialDepth", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_RightEndWallHeight.DataBindings.Add("Text", CommonData.Instance.EndWall.EndWallRight, "Height", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_RightEndWallBaseNumberOfPlies.DataBindings.Add("Text", CommonData.Instance.EndWall.EndWallRight, "BaseNumberOfPlies", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_RightEndWallBaseHeight.DataBindings.Add("Text", CommonData.Instance.EndWall.EndWallRight, "BaseHeight", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_RightEndWallWidth.DataBindings.Add("Text", CommonData.Instance.EndWall.EndWallRight, "Width", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_RightEndWallOverhang.DataBindings.Add("Text", CommonData.Instance.EndWall.EndWallRight, "Overhang", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_RightEndWallEdgeIns.DataBindings.Add("Text", CommonData.Instance.EndWall.EndWallRight, "EdgeIn", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_RightEndWallEdgeOut.DataBindings.Add("Text", CommonData.Instance.EndWall.EndWallRight, "EdgeOut", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_RightEndWallOneMaterial.DataBindings.Add("Text", CommonData.Instance.EndWall.EndWallRight, "Material", true, DataSourceUpdateMode.OnPropertyChanged);
            #endregion
            #region 八字墙 
            //左洞口
            this.cmb_LeftAliformWallInsideEdge.DataBindings.Add("Text", CommonData.Instance.AliformWall.AliformWallLeft, "InsideEdge", true, DataSourceUpdateMode.OnPropertyChanged);
            this.cmb_LeftAliformWallBurialDepth.DataBindings.Add("Text", CommonData.Instance.AliformWall.AliformWallLeft, "BurialDepth", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_LeftAliformWallPaveLengthen.DataBindings.Add("Text", CommonData.Instance.AliformWall.AliformWallLeft, "PavelLengthen", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_LeftAliformWallOutsideEdge.DataBindings.Add("Text", CommonData.Instance.AliformWall.AliformWallLeft, "OutSideEdge", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_LeftAliformWallVerticalWidth.DataBindings.Add("Text", CommonData.Instance.AliformWall.AliformWallLeft, "VeticalWidth", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_LeftAliformWallMinCrossProfileHeight.DataBindings.Add("Text", CommonData.Instance.AliformWall.AliformWallLeft, "MinCrossProfileHeight", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_LeftAliformWallBaseThickness.DataBindings.Add("Text", CommonData.Instance.AliformWall.AliformWallLeft, "BaseThickness", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_LeftAliformWallCutoffWallHeight.DataBindings.Add("Text", CommonData.Instance.AliformWall.AliformWallLeft, "CutoffWallHeight", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_LeftAliformWallPaveThickness.DataBindings.Add("Text", CommonData.Instance.AliformWall.AliformWallLeft, "PaveThickness", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_LeftAliformWallObeyAngle.DataBindings.Add("Text", CommonData.Instance.AliformWall.AliformWallLeft, "ObeyAngle", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_LeftAliformWallContraryAngle.DataBindings.Add("Text", CommonData.Instance.AliformWall.AliformWallLeft, "ContraryAngle", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_LeftAliformWallCarryingCapacity.DataBindings.Add("Text", CommonData.Instance.AliformWall.AliformWallLeft, "CarryingCapacity", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_LeftAliformWallVerticalBackSlope.DataBindings.Add("Text", CommonData.Instance.AliformWall.AliformWallLeft, "VerticalBackSlope", true, DataSourceUpdateMode.OnPropertyChanged);
            this.cmb_LeftAliformWallInEdge.DataBindings.Add("Text", CommonData.Instance.AliformWall.AliformWallLeft, "CulvertInEdge", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_LeftAliformWallPaveSlope.DataBindings.Add("Text", CommonData.Instance.AliformWall.AliformWallLeft, "EntranceCaveSlope", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_LeftAliformWallCutoffWallThickness.DataBindings.Add("Text", CommonData.Instance.AliformWall.AliformWallLeft, "CutoffWallThickness", true, DataSourceUpdateMode.OnPropertyChanged);
            //右洞口
            this.cmb_RightAliformWallInsideEdge.DataBindings.Add("Text", CommonData.Instance.AliformWall.AliformWallRight, "InsideEdge", true, DataSourceUpdateMode.OnPropertyChanged);
            this.cmb_RightAliformWallBurialDepth.DataBindings.Add("Text", CommonData.Instance.AliformWall.AliformWallRight, "BurialDepth", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_RightAliformWallPaveLengthen.DataBindings.Add("Text", CommonData.Instance.AliformWall.AliformWallRight, "PavelLengthen", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_RightAliformWallOutsideEdge.DataBindings.Add("Text", CommonData.Instance.AliformWall.AliformWallRight, "OutSideEdge", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_RightAliformWallVerticalWidth.DataBindings.Add("Text", CommonData.Instance.AliformWall.AliformWallRight, "VeticalWidth", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_RightAliformWallMinCrossProfileHeight.DataBindings.Add("Text", CommonData.Instance.AliformWall.AliformWallRight, "MinCrossProfileHeight", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_RightAliformWallBaseThickness.DataBindings.Add("Text", CommonData.Instance.AliformWall.AliformWallRight, "BaseThickness", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_RightAliformWallCutoffWallHeight.DataBindings.Add("Text", CommonData.Instance.AliformWall.AliformWallRight, "CutoffWallHeight", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_RightAliformWallPaveThickness.DataBindings.Add("Text", CommonData.Instance.AliformWall.AliformWallRight, "PaveThickness", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_RightAliformWallObeyAngle.DataBindings.Add("Text", CommonData.Instance.AliformWall.AliformWallRight, "ObeyAngle", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_RightAliformWallContraryAngle.DataBindings.Add("Text", CommonData.Instance.AliformWall.AliformWallRight, "ContraryAngle", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_RightAliformWallCarryingCapacity.DataBindings.Add("Text", CommonData.Instance.AliformWall.AliformWallRight, "CarryingCapacity", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_RightAliformWallVerticalBackSlope.DataBindings.Add("Text", CommonData.Instance.AliformWall.AliformWallRight, "VerticalBackSlope", true, DataSourceUpdateMode.OnPropertyChanged);
            this.cmb_RightAliformWallInEdge.DataBindings.Add("Text", CommonData.Instance.AliformWall.AliformWallRight, "CulvertInEdge", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_RightAliformWallPaveSlope.DataBindings.Add("Text", CommonData.Instance.AliformWall.AliformWallRight, "EntranceCaveSlope", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_RightAliformWallCutoffWallThickness.DataBindings.Add("Text", CommonData.Instance.AliformWall.AliformWallRight, "CutoffWallThickness", true, DataSourceUpdateMode.OnPropertyChanged);

            #endregion
            #region 锥坡
            /*
             * 左侧锥坡
             */
            //截水墙高(含铺砌)
            this.txt_LeftWaterWallHeight.DataBindings.Add("Text", CommonData.Instance.ConicalSlope.ConicalSlopeLeft, "CutoffWallHeight", true, DataSourceUpdateMode.OnPropertyChanged);
            //洞口铺砌厚度
            this.txt_LeftPavingThickness.DataBindings.Add("Text", CommonData.Instance.ConicalSlope.ConicalSlopeLeft, "PaveThickness", true, DataSourceUpdateMode.OnPropertyChanged);
            //截水墙厚度
            this.txt_LeftWallThickness.DataBindings.Add("Text", CommonData.Instance.ConicalSlope.ConicalSlopeLeft, "CutoffWallThickness", true, DataSourceUpdateMode.OnPropertyChanged);
            this.cmb_LeftSectionSlopeRatio.DataBindings.Add("Text", CommonData.Instance.ConicalSlope.ConicalSlopeLeft, "SlopeRatio", true, DataSourceUpdateMode.OnPropertyChanged);
            this.cmb_LeftBaseDepth.DataBindings.Add("Text", CommonData.Instance.ConicalSlope.ConicalSlopeLeft, "BaseDepth", true, DataSourceUpdateMode.OnPropertyChanged);
            this.cmb_LeftMedialFlank.DataBindings.Add("Text", CommonData.Instance.ConicalSlope.ConicalSlopeLeft, "CulvertInEdge", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_LeftPavingLengthened.DataBindings.Add("Text", CommonData.Instance.ConicalSlope.ConicalSlopeLeft, "AddLenght", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_LeftPavingSlope.DataBindings.Add("Text", CommonData.Instance.ConicalSlope.ConicalSlopeLeft, "EntranceCaveSlope", true, DataSourceUpdateMode.OnPropertyChanged);


            /*
             * 右侧锥坡
             */
            //截水墙高(含铺砌)
            this.txt_RightWaterWallHeight.DataBindings.Add("Text", CommonData.Instance.ConicalSlope.ConicalSlopeRight, "CutoffWallHeight", true, DataSourceUpdateMode.OnPropertyChanged);
            //洞口铺砌厚度
            this.txt_RightPavingThickness.DataBindings.Add("Text", CommonData.Instance.ConicalSlope.ConicalSlopeRight, "PaveThickness", true, DataSourceUpdateMode.OnPropertyChanged);
            //截水墙厚度
            this.txt_RightWallThickness.DataBindings.Add("Text", CommonData.Instance.ConicalSlope.ConicalSlopeRight, "CutoffWallThickness", true, DataSourceUpdateMode.OnPropertyChanged);
            this.cmb_RightSectionSlopeRatio.DataBindings.Add("Text", CommonData.Instance.ConicalSlope.ConicalSlopeRight, "SlopeRatio", true, DataSourceUpdateMode.OnPropertyChanged);
            this.cmb_RightBaseDepth.DataBindings.Add("Text", CommonData.Instance.ConicalSlope.ConicalSlopeRight, "BaseDepth", true, DataSourceUpdateMode.OnPropertyChanged);
            this.cmb_RightMedialFlank.DataBindings.Add("Text", CommonData.Instance.ConicalSlope.ConicalSlopeRight, "CulvertInEdge", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_RightPavingLengthened.DataBindings.Add("Text", CommonData.Instance.ConicalSlope.ConicalSlopeRight, "AddLenght", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_RightPavingSlope.DataBindings.Add("Text", CommonData.Instance.ConicalSlope.ConicalSlopeRight, "EntranceCaveSlope", true, DataSourceUpdateMode.OnPropertyChanged);

            //左右锥坡坡面比
            this.cmb_OverallSlopeRatioLeft.DataBindings.Add("Text", CommonData.Instance.ConicalSlope.ConicalSlopeLeft, "SlopeRatio", true, DataSourceUpdateMode.OnPropertyChanged);
            this.cmb_OverallSlopeRatioRight.DataBindings.Add("Text", CommonData.Instance.ConicalSlope.ConicalSlopeRight, "SlopeRatio", true, DataSourceUpdateMode.OnPropertyChanged);
            //左右锥坡基础深度
            this.cmb_OverallBaseDepthLeft.DataBindings.Add("Text", CommonData.Instance.ConicalSlope.ConicalSlopeLeft, "BaseDepth", true, DataSourceUpdateMode.OnPropertyChanged);
            this.cmb_OverallBaseDepthRight.DataBindings.Add("Text", CommonData.Instance.ConicalSlope.ConicalSlopeRight, "BaseDepth", true, DataSourceUpdateMode.OnPropertyChanged);
            #endregion
            #region 跌水井
            //左跌水井
            this.txt_DropManholeLeft_CenterLength.DataBindings.Add("Text", CommonData.Instance.DropWell.LeftDropWell, "CenterLength", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_DropManholeLeft_Deep.DataBindings.Add("Text", CommonData.Instance.DropWell.LeftDropWell, "Deep", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_DropManholeLeft_WallSlop.DataBindings.Add("Text", CommonData.Instance.DropWell.LeftDropWell, "WellSlope", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_DropManholeLeft_Height.DataBindings.Add("Text", CommonData.Instance.DropWell.LeftDropWell, "Height", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_DropManholeLeft_DepthOfDrainageDitch.DataBindings.Add("Text", CommonData.Instance.DropWell.LeftDropWell, "DepthOfDrainageDitch", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_DropManholeLeft_SlopOfDrainageDitch.DataBindings.Add("Text", CommonData.Instance.DropWell.LeftDropWell, "SlopOfDrainageDitch", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_DropManholeLeft_Slop.DataBindings.Add("Text", CommonData.Instance.DropWell.LeftDropWell, "Slope", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_DropManholeLeft_SlopInsideDitch.DataBindings.Add("Text", CommonData.Instance.DropWell.LeftDropWell, "SlopInsideDitch", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_DropManholeLeft_SlopOutsideDitch.DataBindings.Add("Text", CommonData.Instance.DropWell.LeftDropWell, "SlopOutsideDitch", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_DropManholeLeft_GutterPavingLength.DataBindings.Add("Text", CommonData.Instance.DropWell.LeftDropWell, "GutterPavingLength", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_DropManholeLeft_PrecisionPavingHeight.DataBindings.Add("Text", CommonData.Instance.DropWell.LeftDropWell, "PrecisionPavingHeight", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_DropManholeLeft_InletSlop.DataBindings.Add("Text", CommonData.Instance.DropWell.LeftDropWell, "InletSlop", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_DropManholeLeft_SandPitDepthSwim.DataBindings.Add("Text", CommonData.Instance.DropWell.LeftDropWell, "SandPitDepthSwim", true, DataSourceUpdateMode.OnPropertyChanged);
            //右跌水井
            this.txt_DropManholeRight_CenterLength.DataBindings.Add("Text", CommonData.Instance.DropWell.RightDropWell, "CenterLength", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_DropManholeRight_Deep.DataBindings.Add("Text", CommonData.Instance.DropWell.RightDropWell, "Deep", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_DropManholeRight_WallSlop.DataBindings.Add("Text", CommonData.Instance.DropWell.RightDropWell, "WellSlope", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_DropManholeRight_Height.DataBindings.Add("Text", CommonData.Instance.DropWell.RightDropWell, "Height", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_DropManholeRight_DepthOfDrainageDitch.DataBindings.Add("Text", CommonData.Instance.DropWell.RightDropWell, "DepthOfDrainageDitch", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_DropManholeRight_SlopOfDrainageDitch.DataBindings.Add("Text", CommonData.Instance.DropWell.RightDropWell, "SlopOfDrainageDitch", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_DropManholeRight_Slop.DataBindings.Add("Text", CommonData.Instance.DropWell.RightDropWell, "Slope", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_DropManholeRight_SlopInsideDitch.DataBindings.Add("Text", CommonData.Instance.DropWell.RightDropWell, "SlopInsideDitch", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_DropManholeRight_SlopOutsideDitch.DataBindings.Add("Text", CommonData.Instance.DropWell.RightDropWell, "SlopOutsideDitch", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_DropManholeRight_GutterPavingLength.DataBindings.Add("Text", CommonData.Instance.DropWell.RightDropWell, "GutterPavingLength", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_DropManholeRight_PrecisionPavingHeight.DataBindings.Add("Text", CommonData.Instance.DropWell.RightDropWell, "PrecisionPavingHeight", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_DropManholeRight_InletSlop.DataBindings.Add("Text", CommonData.Instance.DropWell.RightDropWell, "InletSlop", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_DropManholeRight_SandPitDepthSwim.DataBindings.Add("Text", CommonData.Instance.DropWell.RightDropWell, "SandPitDepthSwim", true, DataSourceUpdateMode.OnPropertyChanged);
            #endregion
            #region 跌水
            //左跌水
            this.txt_HeadFallLeft_AngleFlare.DataBindings.Add("Text", CommonData.Instance.HeadFall.LeftHeadFall, "AngleFlare", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_HeadFallLeft_EndlongSlope.DataBindings.Add("Text", CommonData.Instance.HeadFall.LeftHeadFall, "EndlongSlope", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_HeadFallLeft_SideWiden.DataBindings.Add("Text", CommonData.Instance.HeadFall.LeftHeadFall, "SideWiden", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_HeadFallLeft_CutoffWallThickness.DataBindings.Add("Text", CommonData.Instance.HeadFall.LeftHeadFall, "CutoffWallThickness", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_HeadFallLeft_PaveBottomThickness.DataBindings.Add("Text", CommonData.Instance.HeadFall.LeftHeadFall, "PaveBottomThickness", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_HeadFallLeft_Height.DataBindings.Add("Text", CommonData.Instance.HeadFall.LeftHeadFall, "Height", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_HeadFallLeft_PaveLength.DataBindings.Add("Text", CommonData.Instance.HeadFall.LeftHeadFall, "PaveLength", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_HeadFallLeft_CutoffWallHeight.DataBindings.Add("Text", CommonData.Instance.HeadFall.LeftHeadFall, "CutoffWallHeight", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_HeadFallLeft_GutterwayDepth.DataBindings.Add("Text", CommonData.Instance.HeadFall.LeftHeadFall, "GutterwayDepth", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_HeadFallLeft_GutterrwayWallWidth.DataBindings.Add("Text", CommonData.Instance.HeadFall.LeftHeadFall, "GutterrwayWallWidth", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_HeadFallLeft_GutterwaySlopeRatio.DataBindings.Add("Text", CommonData.Instance.HeadFall.LeftHeadFall, "GutterwaySlopeRatio", true, DataSourceUpdateMode.OnPropertyChanged);
            //右跌水
            this.txt_HeadFallRight_AngleFlare.DataBindings.Add("Text", CommonData.Instance.HeadFall.RightHeadFall, "AngleFlare", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_HeadFallRight_EndlongSlope.DataBindings.Add("Text", CommonData.Instance.HeadFall.RightHeadFall, "EndlongSlope", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_HeadFallRight_SideWiden.DataBindings.Add("Text", CommonData.Instance.HeadFall.RightHeadFall, "SideWiden", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_HeadFallRight_CutoffWallThickness.DataBindings.Add("Text", CommonData.Instance.HeadFall.RightHeadFall, "CutoffWallThickness", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_HeadFallRight_PaveBottomThickness.DataBindings.Add("Text", CommonData.Instance.HeadFall.RightHeadFall, "PaveBottomThickness", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_HeadFallRight_Height.DataBindings.Add("Text", CommonData.Instance.HeadFall.RightHeadFall, "Height", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_HeadFallRight_PaveLength.DataBindings.Add("Text", CommonData.Instance.HeadFall.RightHeadFall, "PaveLength", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_HeadFallRight_CutoffWallHeight.DataBindings.Add("Text", CommonData.Instance.HeadFall.RightHeadFall, "CutoffWallHeight", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_HeadFallRight_GutterwayDepth.DataBindings.Add("Text", CommonData.Instance.HeadFall.RightHeadFall, "GutterwayDepth", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_HeadFallRight_GutterrwayWallWidth.DataBindings.Add("Text", CommonData.Instance.HeadFall.RightHeadFall, "GutterrwayWallWidth", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_HeadFallRight_GutterwaySlopeRatio.DataBindings.Add("Text", CommonData.Instance.HeadFall.RightHeadFall, "GutterwaySlopeRatio", true, DataSourceUpdateMode.OnPropertyChanged);
            #endregion
            #region 排水槽
            //左排水槽
            this.txt_RhoneLeft_TopHeight.DataBindings.Add("Text", CommonData.Instance.Rhone.LeftRhone, "TopHeight", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_RhoneLeft_LowHeight.DataBindings.Add("Text", CommonData.Instance.Rhone.LeftRhone, "LowHeight", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_RhoneLeft_Length.DataBindings.Add("Text", CommonData.Instance.Rhone.LeftRhone, "Length", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_RhoneLeft_LongitudinalSlopeOfEntrance.DataBindings.Add("Text", CommonData.Instance.Rhone.LeftRhone, "LongitudinalSlopeOfEntrance", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_RhoneLeft_TopWidth.DataBindings.Add("Text", CommonData.Instance.Rhone.LeftRhone, "TopWidth", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_RhoneLeft_WidenOnOneSide.DataBindings.Add("Text", CommonData.Instance.Rhone.LeftRhone, "WidenOnOneSide", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_RhoneLeft_InsideGrade.DataBindings.Add("Text", CommonData.Instance.Rhone.LeftRhone, "InsideGrade", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_RhoneLeft_OutsideGrade.DataBindings.Add("Text", CommonData.Instance.Rhone.LeftRhone, "OutsideGrade", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_RhoneLeft_GrooveBottomThickness.DataBindings.Add("Text", CommonData.Instance.Rhone.LeftRhone, "GrooveBottomThickness", true, DataSourceUpdateMode.OnPropertyChanged);
            //右排水槽
            this.txt_RhoneRight_TopHeight.DataBindings.Add("Text", CommonData.Instance.Rhone.RightRhone, "TopHeight", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_RhoneRight_LowHeight.DataBindings.Add("Text", CommonData.Instance.Rhone.RightRhone, "LowHeight", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_RhoneRight_Length.DataBindings.Add("Text", CommonData.Instance.Rhone.RightRhone, "Length", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_RhoneRight_LongitudinalSlopeOfEntrance.DataBindings.Add("Text", CommonData.Instance.Rhone.RightRhone, "LongitudinalSlopeOfEntrance", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_RhoneRight_TopWidth.DataBindings.Add("Text", CommonData.Instance.Rhone.RightRhone, "TopWidth", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_RhoneRight_WidenOnOneSide.DataBindings.Add("Text", CommonData.Instance.Rhone.RightRhone, "WidenOnOneSide", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_RhoneRight_InsideGrade.DataBindings.Add("Text", CommonData.Instance.Rhone.RightRhone, "InsideGrade", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_RhoneRight_OutsideGrade.DataBindings.Add("Text", CommonData.Instance.Rhone.RightRhone, "OutsideGrade", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_RhoneRight_GrooveBottomThickness.DataBindings.Add("Text", CommonData.Instance.Rhone.RightRhone, "GrooveBottomThickness", true, DataSourceUpdateMode.OnPropertyChanged);
            #endregion
            #region 边沟跌水井
            this.txt_SideDitchFallWellLeft_ShaftBottomThickness.DataBindings.Add("Text", CommonData.Instance.SideDitchFallWellLeft, "SideDitchFallWell_ShaftBottomThickness", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_SideDitchFallWellLeft_GritBasinDeep.DataBindings.Add("Text", CommonData.Instance.SideDitchFallWellLeft, "SideDitchFallWell_GritBasinDeep", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_SideDitchFallWellLeft_ShaftBottomCenterLength.DataBindings.Add("Text", CommonData.Instance.SideDitchFallWellLeft, "SideDitchFallWell_ShaftBottomCenterLength", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_SideDitchFallWellLeft_ShaftDeep.DataBindings.Add("Text", CommonData.Instance.SideDitchFallWellLeft, "SideDitchFallWell_ShaftDeep", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_SideDitchFallWellLeft_ShaftWallTopWidth.DataBindings.Add("Text", CommonData.Instance.SideDitchFallWellLeft, "SideDitchFallWell_ShaftWallTopWidth", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_SideDitchFallWellLeft_ShaftWallSlopeRatio.DataBindings.Add("Text", CommonData.Instance.SideDitchFallWellLeft, "SideDitchFallWell_ShaftWallSlopeRatio", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_SideDitchFallWellLeft_ShaftOuterWidth.DataBindings.Add("Text", CommonData.Instance.SideDitchFallWellLeft, "SideDitchFallWell_ShaftOuterWidth", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_SideDitchFallWellLeft_ShaftOuterSlope.DataBindings.Add("Text", CommonData.Instance.SideDitchFallWellLeft, "SideDitchFallWell_ShaftOuterSlope", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_SideDitchFallWellLeft_SideDitchOutWallSetover.DataBindings.Add("Text", CommonData.Instance.SideDitchFallWellLeft, "SideDitchFallWell_SideDitchOutWallSetover", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_SideDitchFallWellLeft_SideDitchDeep.DataBindings.Add("Text", CommonData.Instance.SideDitchFallWellLeft, "SideDitchFallWell_SideDitchDeep", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_SideDitchFallWellLeft_SideDitchInSlopeRatio.DataBindings.Add("Text", CommonData.Instance.SideDitchFallWellLeft, "SideDitchFallWell_SideDitchInSlopeRatio", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_SideDitchFallWellLeft_SideDitchBottomWidth.DataBindings.Add("Text", CommonData.Instance.SideDitchFallWellLeft, "SideDitchFallWell_SideDitchBottomWidth", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_SideDitchFallWellLeft_SideDitchOutSlopeRatio.DataBindings.Add("Text", CommonData.Instance.SideDitchFallWellLeft, "SideDitchFallWell_SideDitchOutSlopeRatio", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_SideDitchFallWellLeft_OutWallMaskHeight.DataBindings.Add("Text", CommonData.Instance.SideDitchFallWellLeft, "SideDitchFallWell_OutWallMaskHeight", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_SideDitchFallWellLeft_MaskSlopeRatio.DataBindings.Add("Text", CommonData.Instance.SideDitchFallWellLeft, "SideDitchFallWell_MaskSlopeRatio", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_SideDitchFallWellLeft_FirstMemberStartTalkLength.DataBindings.Add("Text", CommonData.Instance.SideDitchFallWellLeft, "SideDitchFallWell_FirstMemberStartTalkLength", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_SideDitchFallWellLeft_RightMemberStartTalkLength.DataBindings.Add("Text", CommonData.Instance.SideDitchFallWellLeft, "SideDitchFallWell_RightMemberStartTalkLength", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_SideDitchFallWellLeft_SideDitchDrawLength.DataBindings.Add("Text", CommonData.Instance.SideDitchFallWellLeft, "SideDitchFallWell_SideDitchDrawLength", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_SideDitchFallWellLeft_ShaftBottomEndlongSlope.DataBindings.Add("Text", CommonData.Instance.SideDitchFallWellLeft, "SideDitchFallWell_ShaftBottomEndlongSlope", true, DataSourceUpdateMode.OnPropertyChanged);

            this.txt_SideDitchFallWellRight_ShaftBottomThickness.DataBindings.Add("Text", CommonData.Instance.SideDitchFallWellRight, "SideDitchFallWell_ShaftBottomThickness", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_SideDitchFallWellRight_GritBasinDeep.DataBindings.Add("Text", CommonData.Instance.SideDitchFallWellRight, "SideDitchFallWell_GritBasinDeep", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_SideDitchFallWellRight_ShaftBottomCenterLength.DataBindings.Add("Text", CommonData.Instance.SideDitchFallWellRight, "SideDitchFallWell_ShaftBottomCenterLength", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_SideDitchFallWellRight_ShaftDeep.DataBindings.Add("Text", CommonData.Instance.SideDitchFallWellRight, "SideDitchFallWell_ShaftDeep", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_SideDitchFallWellRight_ShaftWallTopWidth.DataBindings.Add("Text", CommonData.Instance.SideDitchFallWellRight, "SideDitchFallWell_ShaftWallTopWidth", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_SideDitchFallWellRight_ShaftWallSlopeRatio.DataBindings.Add("Text", CommonData.Instance.SideDitchFallWellRight, "SideDitchFallWell_ShaftWallSlopeRatio", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_SideDitchFallWellRight_ShaftOuterWidth.DataBindings.Add("Text", CommonData.Instance.SideDitchFallWellRight, "SideDitchFallWell_ShaftOuterWidth", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_SideDitchFallWellRight_ShaftOuterSlope.DataBindings.Add("Text", CommonData.Instance.SideDitchFallWellRight, "SideDitchFallWell_ShaftOuterSlope", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_SideDitchFallWellRight_SideDitchOutWallSetover.DataBindings.Add("Text", CommonData.Instance.SideDitchFallWellRight, "SideDitchFallWell_SideDitchOutWallSetover", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_SideDitchFallWellRight_SideDitchDeep.DataBindings.Add("Text", CommonData.Instance.SideDitchFallWellRight, "SideDitchFallWell_SideDitchDeep", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_SideDitchFallWellRight_SideDitchInSlopeRatio.DataBindings.Add("Text", CommonData.Instance.SideDitchFallWellRight, "SideDitchFallWell_SideDitchInSlopeRatio", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_SideDitchFallWellRight_SideDitchBottomWidth.DataBindings.Add("Text", CommonData.Instance.SideDitchFallWellRight, "SideDitchFallWell_SideDitchBottomWidth", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_SideDitchFallWellRight_SideDitchOutSlopeRatio.DataBindings.Add("Text", CommonData.Instance.SideDitchFallWellRight, "SideDitchFallWell_SideDitchOutSlopeRatio", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_SideDitchFallWellRight_OutWallMaskHeight.DataBindings.Add("Text", CommonData.Instance.SideDitchFallWellRight, "SideDitchFallWell_OutWallMaskHeight", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_SideDitchFallWellRight_MaskSlopeRatio.DataBindings.Add("Text", CommonData.Instance.SideDitchFallWellRight, "SideDitchFallWell_MaskSlopeRatio", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_SideDitchFallWellRight_FirstMemberStartTalkLength.DataBindings.Add("Text", CommonData.Instance.SideDitchFallWellRight, "SideDitchFallWell_FirstMemberStartTalkLength", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_SideDitchFallWellRight_RightMemberStartTalkLength.DataBindings.Add("Text", CommonData.Instance.SideDitchFallWellRight, "SideDitchFallWell_RightMemberStartTalkLength", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_SideDitchFallWellRight_SideDitchDrawLength.DataBindings.Add("Text", CommonData.Instance.SideDitchFallWellRight, "SideDitchFallWell_SideDitchDrawLength", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_SideDitchFallWellRight_ShaftBottomEndlongSlope.DataBindings.Add("Text", CommonData.Instance.SideDitchFallWellRight, "SideDitchFallWell_ShaftBottomEndlongSlope", true, DataSourceUpdateMode.OnPropertyChanged);

            #endregion
            #region 进口急流槽
            //左洞口
            this.txt_ChuteInLeft_Height.DataBindings.Add("Text", CommonData.Instance.CommonChuteIn.LeftCommonChuteIn, "Height", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_ChuteInLeft_BottomPaveThickness.DataBindings.Add("Text", CommonData.Instance.CommonChuteIn.LeftCommonChuteIn, "BottomPaveThickness", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_ChuteInLeft_SlopeRatio.DataBindings.Add("Text", CommonData.Instance.CommonChuteIn.LeftCommonChuteIn, "BodySlope", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_ChuteInLeft_ShaftBottomEndlongSlopeRatio.DataBindings.Add("Text", CommonData.Instance.CommonChuteIn.LeftCommonChuteIn, "ShaftBottomEndlongSlope", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_ChuteInLeft_ShaftBottomPaveThickness.DataBindings.Add("Text", CommonData.Instance.CommonChuteIn.LeftCommonChuteIn, "ShaftBottomPaveThickness", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_ChuteInLeft_ShaftBottomBaseThickness.DataBindings.Add("Text", CommonData.Instance.CommonChuteIn.LeftCommonChuteIn, "ShaftBottomBaseThickness", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_ChuteInLeft_ShaftBottomBaseDeep.DataBindings.Add("Text", CommonData.Instance.CommonChuteIn.LeftCommonChuteIn, "ShaftBottomBaseDeep", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_ChuteInLeft_BaseEdgeThickness.DataBindings.Add("Text", CommonData.Instance.CommonChuteIn.LeftCommonChuteIn, "BaseEdgeThickness", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_ChuteInLeft_SinkFlowWallHeight.DataBindings.Add("Text", CommonData.Instance.CommonChuteIn.LeftCommonChuteIn, "SinkFlowWallHeight", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_ChuteInLeft_SinkFlowWallLegth.DataBindings.Add("Text", CommonData.Instance.CommonChuteIn.LeftCommonChuteIn, "SinkFlowWallLegth", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_ChuteInLeft_SinkFlowWallDiffusionRatio.DataBindings.Add("Text", CommonData.Instance.CommonChuteIn.LeftCommonChuteIn, "SinkFlowWallDiffusionRatio", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_ChuteInLeft_CutoffWallWidth.DataBindings.Add("Text", CommonData.Instance.CommonChuteIn.LeftCommonChuteIn, "CutoffWallWidth", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_ChuteInLeft_CutoffWallHeight.DataBindings.Add("Text", CommonData.Instance.CommonChuteIn.LeftCommonChuteIn, "CutoffWallHeight", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_ChuteInLeft_ShaftWallSlopeRatio.DataBindings.Add("Text", CommonData.Instance.CommonChuteIn.LeftCommonChuteIn, "ShaftWallSlopeRatio", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_ChuteInLeft_TopWidth.DataBindings.Add("Text", CommonData.Instance.CommonChuteIn.LeftCommonChuteIn, "TopWidth", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_ChuteInLeft_ShaftBottomCentreLength.DataBindings.Add("Text", CommonData.Instance.CommonChuteIn.LeftCommonChuteIn, "ShaftBottomCentreLength", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_ChuteInLeft_GritBasinDeep.DataBindings.Add("Text", CommonData.Instance.CommonChuteIn.LeftCommonChuteIn, "GritBasinDeep", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_ChuteInLeft_ShaftDeep.DataBindings.Add("Text", CommonData.Instance.CommonChuteIn.LeftCommonChuteIn, "ShaftDeep", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_ChuteInLeft_EarWallInterval.DataBindings.Add("Text", CommonData.Instance.CommonChuteIn.LeftCommonChuteIn, "EarWallInterval", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_ChuteInLeft_EarWallHeight.DataBindings.Add("Text", CommonData.Instance.CommonChuteIn.LeftCommonChuteIn, "EarWallHeight", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_ChuteInLeft_EarWallWidth.DataBindings.Add("Text", CommonData.Instance.CommonChuteIn.LeftCommonChuteIn, "EarWallWidth", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_ChuteInLeft_SideWiden.DataBindings.Add("Text", CommonData.Instance.CommonChuteIn.LeftCommonChuteIn, "SideWiden", true, DataSourceUpdateMode.OnPropertyChanged);
            //右洞口
            this.txt_ChuteInRight_Height.DataBindings.Add("Text", CommonData.Instance.CommonChuteIn.RightCommonChuteIn, "Height", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_ChuteInRight_BottomPaveThickness.DataBindings.Add("Text", CommonData.Instance.CommonChuteIn.RightCommonChuteIn, "BottomPaveThickness", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_ChuteInRight_SlopeRatio.DataBindings.Add("Text", CommonData.Instance.CommonChuteIn.RightCommonChuteIn, "BodySlope", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_ChuteInRight_ShaftBottomEndlongSlopeRatio.DataBindings.Add("Text", CommonData.Instance.CommonChuteIn.RightCommonChuteIn, "ShaftBottomEndlongSlope", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_ChuteInRight_ShaftBottomPaveThickness.DataBindings.Add("Text", CommonData.Instance.CommonChuteIn.RightCommonChuteIn, "ShaftBottomPaveThickness", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_ChuteInRight_ShaftBottomBaseThickness.DataBindings.Add("Text", CommonData.Instance.CommonChuteIn.RightCommonChuteIn, "ShaftBottomBaseThickness", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_ChuteInRight_ShaftBottomBaseDeep.DataBindings.Add("Text", CommonData.Instance.CommonChuteIn.RightCommonChuteIn, "ShaftBottomBaseDeep", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_ChuteInRight_BaseEdgeThickness.DataBindings.Add("Text", CommonData.Instance.CommonChuteIn.RightCommonChuteIn, "BaseEdgeThickness", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_ChuteInRight_SinkFlowWallHeight.DataBindings.Add("Text", CommonData.Instance.CommonChuteIn.RightCommonChuteIn, "SinkFlowWallHeight", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_ChuteInRight_SinkFlowWallLegth.DataBindings.Add("Text", CommonData.Instance.CommonChuteIn.RightCommonChuteIn, "SinkFlowWallLegth", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_ChuteInRight_SinkFlowWallDiffusionRatio.DataBindings.Add("Text", CommonData.Instance.CommonChuteIn.RightCommonChuteIn, "SinkFlowWallDiffusionRatio", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_ChuteInRight_CutoffWallWidth.DataBindings.Add("Text", CommonData.Instance.CommonChuteIn.RightCommonChuteIn, "CutoffWallWidth", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_ChuteInRight_CutoffWallHeight.DataBindings.Add("Text", CommonData.Instance.CommonChuteIn.RightCommonChuteIn, "CutoffWallHeight", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_ChuteInRight_ShaftWallSlopeRatio.DataBindings.Add("Text", CommonData.Instance.CommonChuteIn.RightCommonChuteIn, "ShaftWallSlopeRatio", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_ChuteInRight_TopWidth.DataBindings.Add("Text", CommonData.Instance.CommonChuteIn.RightCommonChuteIn, "TopWidth", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_ChuteInRight_ShaftBottomCentreLength.DataBindings.Add("Text", CommonData.Instance.CommonChuteIn.RightCommonChuteIn, "ShaftBottomCentreLength", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_ChuteInRight_GritBasinDeep.DataBindings.Add("Text", CommonData.Instance.CommonChuteIn.RightCommonChuteIn, "GritBasinDeep", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_ChuteInRight_ShaftDeep.DataBindings.Add("Text", CommonData.Instance.CommonChuteIn.RightCommonChuteIn, "ShaftDeep", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_ChuteInRight_EarWallInterval.DataBindings.Add("Text", CommonData.Instance.CommonChuteIn.RightCommonChuteIn, "EarWallInterval", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_ChuteInRight_EarWallHeight.DataBindings.Add("Text", CommonData.Instance.CommonChuteIn.RightCommonChuteIn, "EarWallHeight", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_ChuteInRight_EarWallWidth.DataBindings.Add("Text", CommonData.Instance.CommonChuteIn.RightCommonChuteIn, "EarWallWidth", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_ChuteInRight_SideWiden.DataBindings.Add("Text", CommonData.Instance.CommonChuteIn.RightCommonChuteIn, "SideWiden", true, DataSourceUpdateMode.OnPropertyChanged);
            #endregion
            #region 出口急流槽
            //左洞口
            this.txt_ChuteOutLeft_Height.DataBindings.Add("Text", CommonData.Instance.CommonChuteOut.LeftCommonChuteOut, "Height", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_ChuteOutLeft_EndlongSlopeRatio.DataBindings.Add("Text", CommonData.Instance.CommonChuteOut.LeftCommonChuteOut, "EndlongSlopeRatio", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_ChuteOutLeft_Deep.DataBindings.Add("Text", CommonData.Instance.CommonChuteOut.LeftCommonChuteOut, "Deep", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_ChuteOutLeft_DeflectionAngle.DataBindings.Add("Text", CommonData.Instance.CommonChuteOut.LeftCommonChuteOut, "DeflectionAngle", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_ChuteOutLeft_BottomPaveThickness.DataBindings.Add("Text", CommonData.Instance.CommonChuteOut.LeftCommonChuteOut, "BottomPaveThickness", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_ChuteOutLeft_WallThickness.DataBindings.Add("Text", CommonData.Instance.CommonChuteOut.LeftCommonChuteOut, "WallThickness", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_ChuteOutLeft_WingWallLength.DataBindings.Add("Text", CommonData.Instance.CommonChuteOut.LeftCommonChuteOut, "WingWallLength", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_ChuteOutLeft_WingWallAngleFlare.DataBindings.Add("Text", CommonData.Instance.CommonChuteOut.LeftCommonChuteOut, "WingWallAngleFlare", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_ChuteOutLeft_CutoffWallHeight.DataBindings.Add("Text", CommonData.Instance.CommonChuteOut.LeftCommonChuteOut, "CutoffWallHeight", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_ChuteOutLeft_CutoffWallWidth.DataBindings.Add("Text", CommonData.Instance.CommonChuteOut.LeftCommonChuteOut, "CutoffWallWidth", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_ChuteOutLeft_EarWallHeight.DataBindings.Add("Text", CommonData.Instance.CommonChuteOut.LeftCommonChuteOut, "EarWallHeight", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_ChuteOutLeft_EarWallWidth.DataBindings.Add("Text", CommonData.Instance.CommonChuteOut.LeftCommonChuteOut, "EarWallWidth", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_ChuteOutLeft_EarWallInterval.DataBindings.Add("Text", CommonData.Instance.CommonChuteOut.LeftCommonChuteOut, "EarWallInterval", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_ChuteOutLeft_SideWiden.DataBindings.Add("Text", CommonData.Instance.CommonChuteOut.LeftCommonChuteOut, "SideWidth", true, DataSourceUpdateMode.OnPropertyChanged);
            //右洞口
            this.txt_ChuteOutRight_Height.DataBindings.Add("Text", CommonData.Instance.CommonChuteOut.RightCommonChuteOut, "Height", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_ChuteOutRight_EndlongSlopeRatio.DataBindings.Add("Text", CommonData.Instance.CommonChuteOut.RightCommonChuteOut, "EndlongSlopeRatio", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_ChuteOutRight_Deep.DataBindings.Add("Text", CommonData.Instance.CommonChuteOut.RightCommonChuteOut, "Deep", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_ChuteOutRight_DeflectionAngle.DataBindings.Add("Text", CommonData.Instance.CommonChuteOut.RightCommonChuteOut, "DeflectionAngle", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_ChuteOutRight_BottomPaveThickness.DataBindings.Add("Text", CommonData.Instance.CommonChuteOut.RightCommonChuteOut, "BottomPaveThickness", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_ChuteOutRight_WallThickness.DataBindings.Add("Text", CommonData.Instance.CommonChuteOut.RightCommonChuteOut, "WallThickness", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_ChuteOutRight_WingWallLength.DataBindings.Add("Text", CommonData.Instance.CommonChuteOut.RightCommonChuteOut, "WingWallLength", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_ChuteOutRight_WingWallAngleFlare.DataBindings.Add("Text", CommonData.Instance.CommonChuteOut.RightCommonChuteOut, "WingWallAngleFlare", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_ChuteOutRight_CutoffWallHeight.DataBindings.Add("Text", CommonData.Instance.CommonChuteOut.RightCommonChuteOut, "CutoffWallHeight", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_ChuteOutRight_CutoffWallWidth.DataBindings.Add("Text", CommonData.Instance.CommonChuteOut.RightCommonChuteOut, "CutoffWallWidth", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_ChuteOutRight_EarWallHeight.DataBindings.Add("Text", CommonData.Instance.CommonChuteOut.RightCommonChuteOut, "EarWallHeight", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_ChuteOutRight_EarWallWidth.DataBindings.Add("Text", CommonData.Instance.CommonChuteOut.RightCommonChuteOut, "EarWallWidth", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_ChuteOutRight_EarWallInterval.DataBindings.Add("Text", CommonData.Instance.CommonChuteOut.RightCommonChuteOut, "EarWallInterval", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_ChuteOutRight_SideWiden.DataBindings.Add("Text", CommonData.Instance.CommonChuteOut.RightCommonChuteOut, "SideWidth", true, DataSourceUpdateMode.OnPropertyChanged);
            #endregion
            #region 通道

            this.cmb_IsSet.DataBindings.Add("Text", CommonData.Instance.CulvertAisleEntity, "IsGutterway", true, DataSourceUpdateMode.OnPropertyChanged);
            this.cmb_DrainLocation.DataBindings.Add("Text", CommonData.Instance.CulvertAisleEntity, "GutterwayLocation", true, DataSourceUpdateMode.OnPropertyChanged);
            this.cmb_SaidSize.DataBindings.Add("Text", CommonData.Instance.CulvertAisleEntity, "TwoFlanksSize", true, DataSourceUpdateMode.OnPropertyChanged);
            this.cmb_Materials.DataBindings.Add("Text", CommonData.Instance.CulvertAisleEntity, "StopDogMaterials", true, DataSourceUpdateMode.OnPropertyChanged);
            this.cmb_CoverMaterials.DataBindings.Add("Text", CommonData.Instance.CulvertAisleEntity, "CoverPlateMaterials", true, DataSourceUpdateMode.OnPropertyChanged);
            this.cmb_ResetBoard.DataBindings.Add("Text", CommonData.Instance.CulvertAisleEntity, "ShelveMaterials", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_LeftHeight.DataBindings.Add("Text", CommonData.Instance.CulvertAisleEntity, "StopDogHigh_L", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_LeftThickness.DataBindings.Add("Text", CommonData.Instance.CulvertAisleEntity, "StopDogThickness_L", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_LeftWidth.DataBindings.Add("Text", CommonData.Instance.CulvertAisleEntity, "BracketWidth_L", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_LeftDrain.DataBindings.Add("Text", CommonData.Instance.CulvertAisleEntity, "GutterwayWidth_L", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_LeftCoverThickness.DataBindings.Add("Text", CommonData.Instance.CulvertAisleEntity, "CoverPlateThickness_L1", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_LeftResetBoard.DataBindings.Add("Text", CommonData.Instance.CulvertAisleEntity, "ShelveWidth_L", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_LeftSlop.DataBindings.Add("Text", CommonData.Instance.CulvertAisleEntity, "StopDogSlope_L", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_RighttHeight.DataBindings.Add("Text", CommonData.Instance.CulvertAisleEntity, "StopDogHigh_R", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_RightThickness.DataBindings.Add("Text", CommonData.Instance.CulvertAisleEntity, "StopDogThickness_R", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_RightWidth.DataBindings.Add("Text", CommonData.Instance.CulvertAisleEntity, "BracketWidth_R", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_RightDrain.DataBindings.Add("Text", CommonData.Instance.CulvertAisleEntity, "GutterwayWidth_R", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_RightCoverThickness.DataBindings.Add("Text", CommonData.Instance.CulvertAisleEntity, "CoverPlateThickness_R1", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_RightResetBoard.DataBindings.Add("Text", CommonData.Instance.CulvertAisleEntity, "ShelveWidth_R", true, DataSourceUpdateMode.OnPropertyChanged);
            this.txt_RightSlop.DataBindings.Add("Text", CommonData.Instance.CulvertAisleEntity, "StopDogSlope_R", true, DataSourceUpdateMode.OnPropertyChanged);

            #endregion
            #endregion
            cbx_isUse.SelectedIndex = 0;
            isOk = true;
        }


        private void tc_Assemble_DrawItem(object sender, DrawItemEventArgs e)
        {
            string text = ((TabControl)sender).TabPages[e.Index].Text;

            SolidBrush brush = new SolidBrush(Color.Black);

            StringFormat sf = new StringFormat(StringFormatFlags.DirectionRightToLeft)
            {
                LineAlignment = StringAlignment.Center,
                Alignment = StringAlignment.Center
            };
            e.Graphics.DrawString(text, SystemInformation.MenuFont, brush, e.Bounds, sf);
        }

        /// <summary>
        /// 计算左右涵长
        /// </summary>
        private void CalLeftAndRightCulvertLength()
        {
            if ((CommonData.Instance.CommomTotal.LeftLength + CommonData.Instance.CommomTotal.RightLength) != CommonData.Instance.CulvertLength)
            {
                IObjectSpace objectSpase = RepositoryConnectionManager.Instance.GetActive().ObjectSpace;
                Bentley.CifNET.GeometryModel.GeometricModel geometricModel = Bentley.CifNET.GeometryModel.GeometricModel.GetGeometricModel(objectSpase, GetModelOptions.AllowDoNotExist);
                LinearEntity2dInPlan mainLinear = ORDHelp.GetAllAlignmentsInModel(geometricModel).Find(p => p.Name == CommonData.Instance.CommomTotal.SelectAlignments[0].ThisAlignment.Name &&
                    p.Geometry.StartPoint.Coordinates == CommonData.Instance.CommomTotal.SelectAlignments[0].ThisAlignment.LinearGeometry.StartPoint.Coordinates &&
                    p.Geometry.EndPoint.Coordinates == CommonData.Instance.CommomTotal.SelectAlignments[0].ThisAlignment.LinearGeometry.EndPoint.Coordinates);

                DPoint3d staPT = CommonData.Instance.linearEntity2DInPlan.ActiveLinearEntity3dValidBaseGeometry.StartPoint.Coordinates;// .CulverIntersectingLine.ActiveLinearEntity3d.LinearGeometry.StartPoint.Coordinates;
                DPoint3d endPT = CommonData.Instance.linearEntity2DInPlan.ActiveLinearEntity3dValidBaseGeometry.EndPoint.Coordinates;//CulverIntersectingLine.ActiveLinearEntity3d.LinearGeometry.EndPoint.Coordinates;
                DVector3d dVector3D = new DVector3d(staPT, endPT);
                dVector3D.NormalizeInPlace();
                double LL = CommonData.Instance.CulvertLength / Math.Cos(Math.Abs(Math.Atan(CommonData.Instance.CommomTotal.Slope / 100))); //斜边长度
                DPoint3d rightPoint = DPoint3d.Add(CommonData.Instance.culvertPlacePoint3d, dVector3D, LL);
                Line line = new Line(CommonData.Instance.culvertPlacePoint3d, rightPoint);
                //TransformInfo transInfo = new TransformInfo(DTransform3d.Scale(GeneralHelpers.UorToMeters));
                //Bentley.DgnPlatformNET.Elements.LineElement LL = (Bentley.DgnPlatformNET.Elements.LineElement)DraftingElementSchema.ToElement(Session.Instance.GetActiveDgnModel(), line.GetCurveVector(), null);
                //LL.ApplyTransform(transInfo);
                //LL.AddToModel();
                CurveVector intersectionA = new CurveVector(CurveVector.BoundaryType.Inner);
                CurveVector intersectionB = new CurveVector(CurveVector.BoundaryType.Inner);
                CurveCurve.IntersectionsXY(intersectionA, intersectionB, line.GetCurveVector(), mainLinear.Geometry.GetCurveVector());
                intersectionA.GetStartPoint(out DPoint3d pointA);

                CommonData.Instance.CommomTotal.LeftLength = pointA.DistanceXY(CommonData.Instance.culvertPlacePoint3d);
                CommonData.Instance.CommomTotal.RightLength = pointA.DistanceXY(rightPoint);
            }
        }

        public void btn_3D_Click(object sender, EventArgs e)
        {

            if (Session.Instance.GetActiveDgnModel().Is3d == false)
            {
                Bentley.Interop.MicroStationDGN.Application ComApp = Bentley.MstnPlatformNET.InteropServices.Utilities.ComApp;
                ComApp.CadInputQueue.SendCommand("vba run TwoView3D");

                BIM.Views views = ComApp.ActiveDesignFile.Views;
                BIM.View vie = views[2];
                //vie.Maximize();
                vie.Select();
                vie.Redraw();
                //MessageBox.Show("请切换至3D模型绘制!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, MessageBoxOptions.ServiceNotification);
                //return;
            }
            if (tempSwitch)
            {
                if (CommonData.Instance.CommomTotal.LeftAngle == 90)
                {
                    if (this.cmb_CoverplateModel.Text == "")
                    {
                        MessageBox.Show("缺少正盖板，请扩充盖板库!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, MessageBoxOptions.ServiceNotification);
                        return;
                    }
                }
                else
                {
                    if (this.cmb_LeftCoverplateModel.Text == "")
                    {
                        MessageBox.Show("缺少左侧斜盖板，请扩充盖板库!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, MessageBoxOptions.ServiceNotification);
                        return;
                    }
                }
                if (CommonData.Instance.CommomTotal.LeftAngle == 90)
                {
                    if (this.cmb_CoverplateModel.Text == "")
                    {
                        MessageBox.Show("缺少正盖板，请扩充盖板库!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, MessageBoxOptions.ServiceNotification);
                        return;
                    }
                }
                else
                {
                    if (this.cmb_LeftCoverplateModel.Text == "")
                    {
                        MessageBox.Show("缺少右侧斜盖板，请扩充盖板库!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, MessageBoxOptions.ServiceNotification);
                        return;
                    }
                }
            }
            if (CommonData.Instance.CoverPlateParameter.FrontPlate.Length == 0 || CommonData.Instance.CoverPlateParameter.FrontPlate.Width == 0 || CommonData.Instance.CoverPlateParameter.FrontPlate.MidspanThickness == 0 || CommonData.Instance.CoverPlateParameter.FrontPlate.FulcrumThickness == 0)
            {
                if (DgvSubsectionData.ReadDgvConvertSlabSubsection(this.dgv_Slot)[0] == 0)
                {
                    MessageBox.Show("未进行自动分段！");
                    return;
                }
                MessageBox.Show("缺少盖板参数！");
                return;
            }
            try
            {
                if (CommonData.Instance.TempElements.Count > 0)
                    CommonData.Instance.TempElements.ForEach(f => f.DeleteFromModel());
            }
            catch (Exception ex)
            {
                CommonData.Instance.TempElements.Clear();
            }

            culvertCalculateTable = new Coverplate_Culvert_CountSheetEntity();
            SetTableDatas();

            // 通道所用的内壁倒角
            double chamferLength = Convert.ToDouble(txt_UnitaryBottomChamfer.Text.Split('×')[0]) / 100; ;
            if (this.cmb_BasicsType.Text == "整体式")
            {
                CreateUnitaryBsaic();
            }
            else
            {
                CreateSeparatingBasic();
                chamferLength = 0;
            }

            #region XHyu's code 通道 & 一览表

            AisleExcelEntity aisle = SetAisleData();
            CulvertExcelEntity culvert = SetCulvertData();

            Bentley.DgnPlatformNET.ItemTypeLibrary itemTypeLibrary = ItemTypeHelpers.NewTypeLibrary("涵洞");
            Bentley.DgnPlatformNET.ItemType itemType = ItemTypeHelpers.NewItemType(itemTypeLibrary, "涵洞线");

            if (isAisle)
            {
                #region 通道

                CulvertAisleParameter culvertAisle = new CulvertAisleParameter();
                culvertAisle.spanLength = Convert.ToDouble(cmb_ClearSpanAndHeight.Text.Split('×')[0]);
                culvertAisle.angle_L = Convert.ToDouble(txt_LeftCaveAngle.Text);
                culvertAisle.angle_R = Convert.ToDouble(txt_RightCaveAngle.Text);
                culvertAisle.dgnModel = GeneralHelpers.Default3DModel;
                culvertAisle.length = Convert.ToDouble(txt_ExchangeFillLength.Text);
                culvertAisle.chamferLength = chamferLength; // Convert.ToDouble(txt_UnitaryBottomChamfer.Text.Split('×')[0]) / 100;
                culvertAisle.matFormation_dgv = this.dgv_MatFormation;
                bool isGutterway = true;
                if (CommonData.Instance.CulvertAisleEntity.IsGutterway == "否") isGutterway = false;
                culvertAisle.isGutterway = isGutterway;
                culvertAisle.gutterwayLocation = CommonData.Instance.CulvertAisleEntity.GutterwayLocation;
                culvertAisle.twoFlanksSize = CommonData.Instance.CulvertAisleEntity.TwoFlanksSize;
                culvertAisle.stopDogMaterials = CommonData.Instance.CulvertAisleEntity.StopDogMaterials;
                culvertAisle.coverPlateMaterials = CommonData.Instance.CulvertAisleEntity.CoverPlateMaterials;
                culvertAisle.shelveMaterials = CommonData.Instance.CulvertAisleEntity.ShelveMaterials;
                culvertAisle.stopDogHigh_L = CommonData.Instance.CulvertAisleEntity.StopDogHigh_L / 100;
                culvertAisle.stopDogThickness_L = CommonData.Instance.CulvertAisleEntity.StopDogThickness_L / 100;
                culvertAisle.bracketWidth_L = CommonData.Instance.CulvertAisleEntity.BracketWidth_L / 100;
                culvertAisle.gutterwayWidth_L = CommonData.Instance.CulvertAisleEntity.GutterwayWidth_L / 100;
                culvertAisle.CoverPlateThickness_L = CommonData.Instance.CulvertAisleEntity.CoverPlateThickness_L1 / 100;
                culvertAisle.shelveWidth_L = CommonData.Instance.CulvertAisleEntity.ShelveWidth_L / 100;
                culvertAisle.stopDogSlope_L = CommonData.Instance.CulvertAisleEntity.StopDogSlope_L / 100;
                culvertAisle.stopDogHigh_R = CommonData.Instance.CulvertAisleEntity.StopDogHigh_R / 100;
                culvertAisle.stopDogThickness_R = CommonData.Instance.CulvertAisleEntity.StopDogThickness_R / 100;
                culvertAisle.bracketWidth_R = CommonData.Instance.CulvertAisleEntity.BracketWidth_R / 100;
                culvertAisle.gutterwayWidth_R = CommonData.Instance.CulvertAisleEntity.GutterwayWidth_R / 100;
                culvertAisle.CoverPlateThickness_R = CommonData.Instance.CulvertAisleEntity.CoverPlateThickness_R1 / 100;
                culvertAisle.shelveWidth_R = CommonData.Instance.CulvertAisleEntity.ShelveWidth_R / 100;
                culvertAisle.stopDogSlope_R = CommonData.Instance.CulvertAisleEntity.StopDogSlope_R / 100;
                culvertAisle.culvertBottomSlope = Convert.ToDouble(txt_CulvertBaseSlope.Text);

                #region 变换

                double offsetZ = (
                   //CommonData.Instance.SideDitchFallWellLeft.SideDitchFallWell_ShaftBottomThickness +
                   Convert.ToDouble(txt_PointPly.Text) +
                   Convert.ToDouble(cmb_ClearSpanAndHeight.Text.Split('×')[1])
                   );
                //左侧变换
                DTransform3d.TryMirrorPointToPoint(new DPoint3d(-1, 0, 0), new DPoint3d(1, 0, 0), out DTransform3d transX);
                DTransform3d.TryMirrorPointToPoint(new DPoint3d(0, 1, 0), new DPoint3d(0, -1, 0), out DTransform3d transY);
                transX.Translation = new DPoint3d(0, 0, -offsetZ) * GeneralBank.UorToMeters;
                //真实位置
                DTransform3d dTrans3d = new DTransform3d(CommonData.Instance.placePtDmatrix3d);
                dTrans3d.Translation = CommonData.Instance.culvertPlacePoint3d * GeneralBank.UorToMeters;
                TransformInfo dTransFormInfo = new TransformInfo(dTrans3d);
                Angle angle_CulvertAisle = new Angle();
                angle_CulvertAisle.Radians = Math.PI / 180 * (90);
                DTransform3d trans_CulvertAisle = DTransform3d.Rotation(DVector3d.UnitZ, angle_CulvertAisle);

                #endregion

                CreateCulvertAisle createCulvertAisle = new CreateCulvertAisle(culvertAisle);

                List<Element> elements = new List<Element>();
                string levelName = "";
                string materialName = "混凝土";

                // 挡块
                levelName = "挡块";
                if (createCulvertAisle.culvertAisleElement.stopDogElement_L != null)
                {
                    elements.Add(createCulvertAisle.culvertAisleElement.stopDogElement_L);

                    GeneralHelpers.AssignLevelToElement(createCulvertAisle.culvertAisleElement.stopDogElement_L, levelName); //元素赋予图层
                    createCulvertAisle.culvertAisleElement.stopDogElement_L.ApplyTransform(new TransformInfo(trans_CulvertAisle));
                    createCulvertAisle.culvertAisleElement.stopDogElement_L.ApplyTransform(new TransformInfo(transX));
                    createCulvertAisle.culvertAisleElement.stopDogElement_L.ApplyTransform(new TransformInfo(transY));
                    createCulvertAisle.culvertAisleElement.stopDogElement_L.ApplyTransform(dTransFormInfo);
                    createCulvertAisle.culvertAisleElement.stopDogElement_L.AddToModel();
                    GeneralHelpers.AssignMaterialToElement(createCulvertAisle.culvertAisleElement.stopDogElement_L, materialName); //元素赋予材质
                }
                if (createCulvertAisle.culvertAisleElement.stopDogElement_R != null)
                {
                    elements.Add(createCulvertAisle.culvertAisleElement.stopDogElement_R);

                    GeneralHelpers.AssignLevelToElement(createCulvertAisle.culvertAisleElement.stopDogElement_R, levelName); //元素赋予图层
                    createCulvertAisle.culvertAisleElement.stopDogElement_R.ApplyTransform(new TransformInfo(trans_CulvertAisle));
                    createCulvertAisle.culvertAisleElement.stopDogElement_R.ApplyTransform(new TransformInfo(transX));
                    createCulvertAisle.culvertAisleElement.stopDogElement_R.ApplyTransform(new TransformInfo(transY));
                    createCulvertAisle.culvertAisleElement.stopDogElement_R.ApplyTransform(dTransFormInfo);
                    createCulvertAisle.culvertAisleElement.stopDogElement_R.AddToModel();
                    GeneralHelpers.AssignMaterialToElement(createCulvertAisle.culvertAisleElement.stopDogElement_R, materialName); //元素赋予材质
                }

                // 搁置板
                levelName = "搁置板";
                if (createCulvertAisle.culvertAisleElement.shelveElement_L != null)
                {
                    elements.Add(createCulvertAisle.culvertAisleElement.shelveElement_L);

                    GeneralHelpers.AssignLevelToElement(createCulvertAisle.culvertAisleElement.shelveElement_L, levelName); //元素赋予图层
                    createCulvertAisle.culvertAisleElement.shelveElement_L.ApplyTransform(new TransformInfo(trans_CulvertAisle));
                    createCulvertAisle.culvertAisleElement.shelveElement_L.ApplyTransform(new TransformInfo(transX));
                    createCulvertAisle.culvertAisleElement.shelveElement_L.ApplyTransform(new TransformInfo(transY));
                    createCulvertAisle.culvertAisleElement.shelveElement_L.ApplyTransform(dTransFormInfo);
                    createCulvertAisle.culvertAisleElement.shelveElement_L.AddToModel();
                    GeneralHelpers.AssignMaterialToElement(createCulvertAisle.culvertAisleElement.shelveElement_L, materialName); //元素赋予材质
                }
                if (createCulvertAisle.culvertAisleElement.shelveElement_R != null)
                {
                    elements.Add(createCulvertAisle.culvertAisleElement.shelveElement_R);

                }

                // 盖板
                levelName = "盖板";
                if (createCulvertAisle.culvertAisleElement.cuboidElement_L != null)
                {
                    elements.Add(createCulvertAisle.culvertAisleElement.cuboidElement_L);

                    GeneralHelpers.AssignLevelToElement(createCulvertAisle.culvertAisleElement.cuboidElement_L, levelName); //元素赋予图层
                    createCulvertAisle.culvertAisleElement.cuboidElement_L.ApplyTransform(new TransformInfo(trans_CulvertAisle));
                    createCulvertAisle.culvertAisleElement.cuboidElement_L.ApplyTransform(new TransformInfo(transX));
                    createCulvertAisle.culvertAisleElement.cuboidElement_L.ApplyTransform(new TransformInfo(transY));
                    createCulvertAisle.culvertAisleElement.cuboidElement_L.ApplyTransform(dTransFormInfo);
                    createCulvertAisle.culvertAisleElement.cuboidElement_L.AddToModel();
                    GeneralHelpers.AssignMaterialToElement(createCulvertAisle.culvertAisleElement.cuboidElement_L, materialName); //元素赋予材质

                }
                if (createCulvertAisle.culvertAisleElement.cuboidElement_R != null)
                {
                    elements.Add(createCulvertAisle.culvertAisleElement.cuboidElement_R);

                    GeneralHelpers.AssignLevelToElement(createCulvertAisle.culvertAisleElement.cuboidElement_R, levelName); //元素赋予图层
                    createCulvertAisle.culvertAisleElement.cuboidElement_R.ApplyTransform(new TransformInfo(trans_CulvertAisle));
                    createCulvertAisle.culvertAisleElement.cuboidElement_R.ApplyTransform(new TransformInfo(transX));
                    createCulvertAisle.culvertAisleElement.cuboidElement_R.ApplyTransform(new TransformInfo(transY));
                    createCulvertAisle.culvertAisleElement.cuboidElement_R.ApplyTransform(dTransFormInfo);
                    createCulvertAisle.culvertAisleElement.cuboidElement_R.AddToModel();
                    GeneralHelpers.AssignMaterialToElement(createCulvertAisle.culvertAisleElement.cuboidElement_R, materialName); //元素赋予材质
                }

                // 铺装
                levelName = "铺装";
                for (var i = 0; i < createCulvertAisle.culvertAisleElement.matFoemationElement.Count; i++)
                {
                    Element item = createCulvertAisle.culvertAisleElement.matFoemationElement[i];

                    GeneralHelpers.AssignLevelToElement(item, levelName); //元素赋予图层
                    item.ApplyTransform(new TransformInfo(trans_CulvertAisle));
                    item.ApplyTransform(new TransformInfo(transX));
                    item.ApplyTransform(new TransformInfo(transY));
                    item.ApplyTransform(dTransFormInfo);
                    item.AddToModel();

                    string matFormationMaterials = culvertAisle.matFormation_dgv[2, i].Value.ToString();
                    if (matFormationMaterials.Contains("沙砾")) materialName = "沙砾碎石";

                    GeneralHelpers.AssignMaterialToElement(item, materialName); //元素赋予材质

                    elements.Add(item); // 添加Id
                }

                foreach (var item in elements)
                {
                    CommonData.Instance.ElementIds.Add(item.ElementId.ToString()); // 添加Id
                }

                //foreach (var item in elements)
                //{
                //    item.ApplyTransform(new TransformInfo(trans_CulvertAisle));
                //    item.ApplyTransform(new TransformInfo(transX));
                //    item.ApplyTransform(new TransformInfo(transY));
                //    item.ApplyTransform(dTransFormInfo);
                //    item.AddToModel();
                //}

                #endregion

                CustomProperty customProperty = ItemTypeHelpers.NewPropertyType(itemType, "通道一览表", CustomProperty.TypeKind.String, isArry: false, true);
                CustomProperty customProperty1 = ItemTypeHelpers.NewPropertyType(itemType, "通道工程数量表", CustomProperty.TypeKind.String, isArry: false, true);

                PrefabricateNomalSlabCulvert4m.uitl.refSoiled.BodyProperty.AttachItemToElement(
                    ele: CommonData.Instance.CommomTotal.SelectLine,
                    itemLibName: "涵洞",
                    itemTypeName: "涵洞线",
                    propertyName: "通道一览表", CustomProperty.TypeKind.String,
                    propertyValue: JsonConvert.SerializeObject(aisle));

                PrefabricateNomalSlabCulvert4m.uitl.refSoiled.BodyProperty.AttachItemToElement(
                    ele: CommonData.Instance.CommomTotal.SelectLine,
                    itemLibName: "涵洞",
                    itemTypeName: "涵洞线",
                    propertyName: "通道工程数量表", CustomProperty.TypeKind.String,
                    propertyValue: JsonConvert.SerializeObject(culvertCalculateTable));
            }
            else
            {
                CustomProperty customProperty = ItemTypeHelpers.NewPropertyType(itemType, "涵洞一览表", CustomProperty.TypeKind.String, isArry: false, true);
                CustomProperty customProperty3 = ItemTypeHelpers.NewPropertyType(itemType, "涵洞工程数量表", CustomProperty.TypeKind.String, isArry: false, true);

                PrefabricateNomalSlabCulvert4m.uitl.refSoiled.BodyProperty.AttachItemToElement(
                    ele: CommonData.Instance.CommomTotal.SelectLine,
                    itemLibName: "涵洞",
                    itemTypeName: "涵洞线",
                    propertyName: "涵洞一览表", CustomProperty.TypeKind.String,
                    propertyValue: JsonConvert.SerializeObject(culvert));


                PrefabricateNomalSlabCulvert4m.uitl.refSoiled.BodyProperty.AttachItemToElement(
                    ele: CommonData.Instance.CommomTotal.SelectLine,
                    itemLibName: "涵洞",
                    itemTypeName: "涵洞线",
                    propertyName: "涵洞工程数量表", CustomProperty.TypeKind.String,
                    propertyValue: JsonConvert.SerializeObject(culvertCalculateTable));
            }

            #endregion

            //保存数据
            btn_save_Click(sender, e);
        }

        #region 涵洞/通道 一览表datasets

        private AisleExcelEntity SetAisleData()
        {
            double leftLength = CommonData.Instance.CommomTotal.LeftLength;
            double rightLength = CommonData.Instance.CommomTotal.RightLength;
            double elevation = CommonData.Instance.CommomTotal.Elevation;
            double slop = CommonData.Instance.CommomTotal.Slope;

            string generalCurrent = "";
            string entranceElevation = "";
            string exitElevation = "";

            if (CommonData.Instance.CommomTotal.Slope < 0)
            {
                generalCurrent = "从左向右";
                entranceElevation = (elevation - slop * leftLength).ToString();
                exitElevation = (elevation + slop * rightLength).ToString();
            }
            else
            {
                generalCurrent = "从右向左";
                entranceElevation = (elevation + slop * leftLength).ToString();
                exitElevation = (elevation - slop * rightLength).ToString();
            }

            AisleExcelEntity aisle = new AisleExcelEntity();
            aisle.CenterNum = txt_CulvertStake.Text;
            aisle.ProjectName = "通道";
            aisle.RoadType = "";
            aisle.Angle = CommonData.Instance.CommomTotal.RightAngle.ToString();
            aisle.StructuralType = "钢筋砼盖板涵";
            aisle.HoleSize = "1-" + CommonData.Instance.CommomTotal.ClearSpanHeadroom;
            aisle.Entrance = cmb_LeftCave.Text;
            aisle.Exit = cmb_RightCave.Text;
            aisle.CulvertLength = CommonData.Instance.CommomTotal.FillValue.ToString();
            aisle.CatchmentArea = "";
            aisle.DesignFlow = "";
            aisle.GeneralCurrent = generalCurrent;
            aisle.EntranceFillHeight = entranceElevation;
            aisle.LayLineElevation = CommonData.Instance.CommomTotal.Elevation.ToString();
            aisle.ExitFillHeight = exitElevation;
            aisle.Slop = CommonData.Instance.CommomTotal.Slope.ToString();
            aisle.Remark = "";

            return aisle;
        }

        private CulvertExcelEntity SetCulvertData()
        {
            CulvertExcelEntity culvert = new CulvertExcelEntity();

            double leftLength = CommonData.Instance.CommomTotal.LeftLength;
            double rightLength = CommonData.Instance.CommomTotal.RightLength;
            double elevation = CommonData.Instance.CommomTotal.Elevation;
            double slop = CommonData.Instance.CommomTotal.Slope;

            string generalCurrent = "";
            string entranceElevation = "";
            string exitElevation = "";

            if (CommonData.Instance.CommomTotal.Slope < 0)
            {
                generalCurrent = "从左向右";
                entranceElevation = (elevation - slop * leftLength).ToString();
                exitElevation = (elevation + slop * rightLength).ToString();
            }
            else
            {
                generalCurrent = "从右向左";
                entranceElevation = (elevation + slop * leftLength).ToString();
                exitElevation = (elevation - slop * rightLength).ToString();
            }

            culvert.CenterNum = txt_CulvertStake.Text;
            culvert.StructuralType = "钢筋砼盖板涵";
            culvert.Angle = CommonData.Instance.CommomTotal.RightAngle.ToString();
            culvert.HoleSize = "1-" + CommonData.Instance.CommomTotal.ClearSpanHeadroom;
            culvert.FillHeight = txt_Fill.Text;
            culvert.CulvertLength = CommonData.Instance.CommomTotal.FillValue.ToString();
            culvert.Entrance = cmb_LeftCave.Text;
            culvert.Exit = cmb_RightCave.Text;
            culvert.CatchmentArea = "";
            culvert.DesignFlow = "";
            culvert.GeneralCurrent = generalCurrent;
            culvert.EntranceFillHeight = entranceElevation;
            culvert.LayLineElevation = CommonData.Instance.CommomTotal.Elevation.ToString();
            culvert.ExitFillHeight = exitElevation;
            culvert.Slop = CommonData.Instance.CommomTotal.Slope.ToString();
            culvert.Remark = "";

            return culvert;
        }

        #endregion

        #region 工程数量表
        /// <summary>
        /// 设置表格数据
        /// </summary>
        private void SetTableDatas()
        {
            if (null == culvertCalculateTable) return;
            culvertCalculateTable.CenterStakeMark = CommonData.Instance.CommomTotal.CulvertStackMark;
            culvertCalculateTable.HoleNumAndClearHeight = CommonData.Instance.CommomTotal.ClearSpanHeadroom;
            culvertCalculateTable.StructureType = "盖板涵";
            culvertCalculateTable.Angle = CommonData.Instance.CommomTotal.CrossingAngle;
            culvertCalculateTable.CulvertLength = CommonData.Instance.CulvertLength;
            culvertCalculateTable.CulvertOpenTypeLeft = CommonData.Instance.CommomTotal.EntranceToCave.Left.Type;
            culvertCalculateTable.CulvertOpenTypeRight = CommonData.Instance.CommomTotal.EntranceToCave.Right.Type;
            culvertCalculateTable.BaseType = CommonData.Instance.CommomTotal.BaseType;
            culvertCalculateTable.CulvertType = CommonData.Instance.CommomTotal.CoverPlateType;
        }

        /// <summary>
        /// 设置数量表数据
        /// </summary>
        /// <param name="structureName">构建名称</param>
        /// <param name="materialName">材质名</param>
        /// <param name="materialTypeName">材质类型名称</param>
        /// <param name="value">数据</param>
        /// <param name="unit">单位</param>
        public static void SetTableData(string structureName, string materialName, string materialTypeName, double value, string unit)
        {
            //包含的构建索引位置
            int structureIndex = 999;
            if (!culvertCalculateTable.BlockEntities.Any(a => a.Name == structureName))
            {
                culvertCalculateTable.BlockEntities.Add(new BlockEntity() { Name = structureName, Types = new List<CheccCoverplateCulvertAssemble.Entity.Type>() });
                structureIndex = culvertCalculateTable.BlockEntities.Count - 1;
            }
            else
            {
                foreach (var item in culvertCalculateTable.BlockEntities)
                {
                    if (item.Name == structureName)
                        structureIndex = culvertCalculateTable.BlockEntities.IndexOf(item);
                }
            }

            //是否包含材质
            bool isMaterialName = false;
            //包含的索引位置
            int materialIndex = 999;
            foreach (var type in culvertCalculateTable.BlockEntities[structureIndex].Types)
            {
                if (type.Name == materialName)
                {
                    isMaterialName = true;
                    materialIndex = culvertCalculateTable.BlockEntities[structureIndex].Types.IndexOf(type);
                    break;
                }
            }
            if (!isMaterialName)
            {
                culvertCalculateTable.BlockEntities[structureIndex].Types.Add(new CheccCoverplateCulvertAssemble.Entity.Type() { Name = materialName, SingleMaterials = new List<SingleMaterial>() });
                materialIndex = culvertCalculateTable.BlockEntities[structureIndex].Types.Count - 1;
            }

            //是否包含材质类型
            bool isMaterialType = false;
            //包含的索引位置
            int materialTypeIndex = 999;
            foreach (var singleMaterial in culvertCalculateTable.BlockEntities[structureIndex].Types[materialIndex].SingleMaterials)
            {
                if (singleMaterial.MaterialName == materialTypeName)
                {
                    isMaterialType = true;
                    materialTypeIndex = culvertCalculateTable.BlockEntities[structureIndex].Types[materialIndex].SingleMaterials.IndexOf(singleMaterial);
                    break;
                }
            }
            if (isMaterialType)
            {
                culvertCalculateTable.BlockEntities[structureIndex].Types[materialIndex].SingleMaterials[materialTypeIndex].Value += value;
                culvertCalculateTable.BlockEntities[structureIndex].Types[materialIndex].SingleMaterials[materialTypeIndex].Unit = unit;
            }
            else
            {
                culvertCalculateTable.BlockEntities[structureIndex].Types[materialIndex].SingleMaterials.Add(new SingleMaterial()
                {
                    MaterialName = materialTypeName,
                    Unit = unit,
                    Value = value
                });
            }

        }
        #endregion

        private void CreateUnitaryBsaic()
        {

            BasicConstructor basicConstructor = new BasicConstructor
            {

                LeftLateralAngle = CommonData.Instance.CommomTotal.LeftAngle,
                RightLateralAngle = CommonData.Instance.CommomTotal.RightAngle,
                CulvertGapWidth = Convert.ToDouble(this.txt_SedimentationWidth.Text),
                BaseGapWidth = Convert.ToDouble(this.txt_BaseWidth.Text),
                CulvertBaseSlope = CommonData.Instance.CommomTotal.Slope,
                ClearSpan = Convert.ToDouble(CommonData.Instance.CommomTotal.ClearSpanHeadroom.Split('×')[0].Trim()),
                ClearHeight = Convert.ToDouble(CommonData.Instance.CommomTotal.ClearSpanHeadroom.Split('×')[1].Trim()),
                PiecePly = Convert.ToDouble(this.txt_UnitaryPiecePly.Text),
                BasicsEdge = Convert.ToDouble(this.txt_UnitaryBasics.Text),
                StandPly = Convert.ToDouble(this.txt_UnitaryStandPly.Text),
                StandTopWidth = Convert.ToDouble(this.txt_UnitaryStandTopWidth.Text),
                BottomChamfer = Convert.ToDouble(this.txt_UnitaryBottomChamfer.Text),
                BasicsPly = Convert.ToDouble(this.txt_UnitaryBasicsPly.Text),
                ProtectiveLayer = Convert.ToDouble(this.cmb_UnitaryProtectiveLayer.Text),
                //CrossingAngle = Convert.ToDouble(this.tbox_CulvertCrossingAngle.Text),
                ExchangeFillDepth = Convert.ToDouble(this.txt_ExchangeFillDepth.Text),
                ExchangeFillLength = Convert.ToDouble(this.txt_ExchangeFillLength.Text),
                ExchangeFillSlopeRatio = Convert.ToDouble(this.txt_ExchangeFillSlopeRatio.Text),
                ExchangeFillEdge = Convert.ToDouble(this.txt_ExchangeFillEdge.Text)
            };
            CommonData.Instance.basicConstructor = basicConstructor;
            //涵身钢筋数据
            RebarEntity rebarData = SetDataGridViewData(CommonData.Instance.CommomTotal.GeneralDiagram, CommonData.Instance.CommomTotal.ClearSpanHeadroom, CommonData.Instance.CommomTotal.FillValue, this.cmb_UnitaryProtectiveLayer.Text);

            //根据沉降缝计算分度涵长
            List<double> culvertLenLists = DgvSubsectionData.ReadDgvConvertSectionSubsection(this.dgv_Slot);
            CommonData.Instance.culvertLenLists = culvertLenLists;
            CommonData.Instance.replaceMent = replaceMent;
            double basicsLength = culvertLenLists.Take(culvertLenLists.Count).Sum() / 100;
            for (int i = 0; i < culvertLenLists.Count; i++)
            {
                basicConstructor.BasicsLength = culvertLenLists[i];
                if (i == 0) // && basicConstructor.LeftLateralAngle != 90
                {
                    FactoryCreator unitaryBasicFactory = new UnitaryBasicLeftFactory(rebarData);
                    ConstructingEntity constructingEntity = unitaryBasicFactory.ConstructingEntityCreator(basicConstructor, CulvertType.SlabCulvert, ConstructionMethod.CastInPlace, CulvertComponentType.CulvertBody);
                    constructingEntity.distanceFromStart = 0;
                    constructingEntity.dMatrix3D = CommonData.Instance.placePtDmatrix3d;
                    constructingEntity.placeDpoint3d = CommonData.Instance.culvertPlacePoint3d;
                    constructingEntity.CreateEntityModel();
                }
                else if (i == culvertLenLists.Count - 1)
                {
                    FactoryCreator unitaryBasicFactory = new UnitaryBasicRightFactory(rebarData);
                    ConstructingEntity constructingEntity = unitaryBasicFactory.ConstructingEntityCreator(basicConstructor, CulvertType.SlabCulvert, ConstructionMethod.CastInPlace, CulvertComponentType.CulvertBody);
                    constructingEntity.distanceFromStart = culvertLenLists.Take(i).Sum() / 100;
                    constructingEntity.dMatrix3D = CommonData.Instance.placePtDmatrix3d;
                    constructingEntity.placeDpoint3d = CommonData.Instance.culvertPlacePoint3d;
                    constructingEntity.CreateEntityModel();
                }
                else
                {
                    FactoryCreator unitaryBasicFactory = new UnitaryBasicFactory(rebarData);
                    ConstructingEntity constructingEntity = unitaryBasicFactory.ConstructingEntityCreator(basicConstructor, CulvertType.SlabCulvert, ConstructionMethod.CastInPlace, CulvertComponentType.CulvertBody);
                    constructingEntity.distanceFromStart = culvertLenLists.Take(i).Sum() / 100;
                    constructingEntity.dMatrix3D = CommonData.Instance.placePtDmatrix3d;
                    constructingEntity.placeDpoint3d = CommonData.Instance.culvertPlacePoint3d;
                    constructingEntity.CreateEntityModel();
                }
            }
            //换填
            if (this.cb_IsExchangeFill.Checked)
            {
                FactoryCreator unitaryBasicFactory = new ReplaceMentFactory();
                ConstructingEntity constructingEntity = unitaryBasicFactory.ConstructingEntityCreator(basicConstructor, CulvertType.SlabCulvert, ConstructionMethod.CastInPlace, CulvertComponentType.OrthogonalityCover);
                constructingEntity.distanceFromStart = 0;
                constructingEntity.keyValuePairs = replaceMent;
                constructingEntity.basicType = BasicType.UnitaryBasic;
                constructingEntity.dMatrix3D = CommonData.Instance.placePtDmatrix3d;
                constructingEntity.placeDpoint3d = CommonData.Instance.culvertPlacePoint3d;
                constructingEntity.CreateEntityModel();
            }

            //左侧端墙
            if (this.cmb_LeftHeadWall.Text == "设置")
            {
                FactoryCreator endWallFactory = new EndWallFactory(CommonData.Instance.EndWall.EndWallLeft, CommonData.Instance.CapStone.CapStoneLeft, CapLocation.Left, basicsLength);
                ConstructingEntity endWallEntity = endWallFactory.ConstructingEntityCreator(basicConstructor, CulvertType.SlabCulvert, ConstructionMethod.Precast, CulvertComponentType.OrthogonalityCover);
                endWallEntity.dMatrix3D = CommonData.Instance.placePtDmatrix3d;
                endWallEntity.placeDpoint3d = CommonData.Instance.culvertPlacePoint3d;
                endWallEntity.CreateEntityModel();
            }
            //右侧端墙
            if (this.cmb_RightHeadWall.Text == "设置")
            {
                FactoryCreator endWallFactoryR = new EndWallFactory(CommonData.Instance.EndWall.EndWallRight, CommonData.Instance.CapStone.CapStoneRight, CapLocation.Right, basicsLength);
                ConstructingEntity endWallEntityR = endWallFactoryR.ConstructingEntityCreator(basicConstructor, CulvertType.SlabCulvert, ConstructionMethod.Precast, CulvertComponentType.OrthogonalityCover);
                endWallEntityR.dMatrix3D = CommonData.Instance.placePtDmatrix3d;
                endWallEntityR.placeDpoint3d = CommonData.Instance.culvertPlacePoint3d;
                endWallEntityR.CreateEntityModel();
            }
            #region 放置盖板

            Dictionary<string, List<string>> keyValuePairs = new Dictionary<string, List<string>>();
            Dictionary<string, List<string>> keyValuePairsLeft = new Dictionary<string, List<string>>();
            Dictionary<string, List<string>> keyValuePairsRight = new Dictionary<string, List<string>>();
            string cellName = string.Empty;
            string leftCellName = string.Empty;
            string rightCellName = string.Empty;
            if (CommonData.Instance.CommomTotal.WhetherGeneralDiagram == "是")
            {
                /*
                 10为盖板角度，正盖板为空，角度需要涵身斜角减去90度
                 */
                keyValuePairs = GetCellNameToModelName(CommonData.Instance.CommomTotal.GeneralDiagram, CommonData.Instance.CommomTotal.FillValue, CommonData.Instance.CommomTotal.ClearSpanHeadroom, 0, null, CommonData.Instance.CommomTotal.CoverPlateType == "预制" ? ConstructionScheme.Precast : ConstructionScheme.CastInPlace, CulvertFoundationType.FrontCover);
                keyValuePairsLeft = GetCellNameToModelName(CommonData.Instance.CommomTotal.GeneralDiagram, CommonData.Instance.CommomTotal.FillValue, CommonData.Instance.CommomTotal.ClearSpanHeadroom, Math.Abs(90 - CommonData.Instance.CommomTotal.LeftAngle), InclinedPlate.Left, CommonData.Instance.CommomTotal.CoverPlateType == "预制" ? ConstructionScheme.Precast : ConstructionScheme.CastInPlace, CulvertFoundationType.InclinedCover);
                keyValuePairsRight = GetCellNameToModelName(CommonData.Instance.CommomTotal.GeneralDiagram, CommonData.Instance.CommomTotal.FillValue, CommonData.Instance.CommomTotal.ClearSpanHeadroom, Math.Abs(90 - CommonData.Instance.CommomTotal.RightAngle), InclinedPlate.Right, CommonData.Instance.CommomTotal.CoverPlateType == "预制" ? ConstructionScheme.Precast : ConstructionScheme.CastInPlace, CulvertFoundationType.InclinedCover);

                for (int i = 0; i < keyValuePairs.Keys.Count; i++)
                {
                    for (int k = 0; k < keyValuePairs.ElementAt(i).Value.Count; k++)
                    {
                        if (keyValuePairs.ElementAt(i).Value[k].ToString() == CommonData.Instance.CoverPlateParameter.FrontPlate.StandardPlateModel)//"广东版_4.0×4.0_(4.0，6.0]_4.56_0.99_0.55_0.55_0.035"
                        {
                            cellName = keyValuePairs.ElementAt(i).Key.ToString();
                            break;
                        }
                    }
                }
                for (int i = 0; i < keyValuePairsLeft.Keys.Count; i++)
                {
                    for (int k = 0; k < keyValuePairsLeft.ElementAt(i).Value.Count; k++)
                    {
                        if (keyValuePairsLeft.ElementAt(i).Value[k].ToString() == CommonData.Instance.CoverPlateParameter.LeftInclinedPlate.StandardPlateModel)
                        {
                            leftCellName = keyValuePairsLeft.ElementAt(i).Key.ToString();
                            break;
                        }
                    }
                }
                for (int i = 0; i < keyValuePairsRight.Keys.Count; i++)
                {
                    for (int k = 0; k < keyValuePairsRight.ElementAt(i).Value.Count; k++)
                    {
                        if (keyValuePairsRight.ElementAt(i).Value[k].ToString() == CommonData.Instance.CoverPlateParameter.RightInclinedPlate.StandardPlateModel)
                        {
                            rightCellName = keyValuePairsRight.ElementAt(i).Key.ToString();
                            break;
                        }
                    }
                }
            }


            //放置盖板
            PlaceSlab placeSlab = new PlaceSlab(
                CommonData.Instance.CoverPlateParameter.LeftInclinedPlate.StandardPlateModel,
                leftCellName,
                CommonData.Instance.CoverPlateParameter.FrontPlate.StandardPlateModel,
                cellName,
                CommonData.Instance.CoverPlateParameter.RightInclinedPlate.StandardPlateModel,
                rightCellName,
                CommonData.Instance.placePtDmatrix3d,
                CommonData.Instance.culvertPlacePoint3d
                );

            //是否采用通用图
            if (CommonData.Instance.CommomTotal.WhetherGeneralDiagram == "是")
                placeSlab.PlaceTiltSlab(
                    DgvSubsectionData.ReadDgvConvertSlabSubsection(this.dgv_Slot),
                    basicConstructor.CulvertBaseSlope * 0.01,
                    basicConstructor.CulvertGapWidth * 0.01,
                    basicConstructor.LeftLateralAngle,
                    basicConstructor.RightLateralAngle,
                    basicConstructor.PiecePly * 0.01,
                    CommonData.Instance.CommomTotal.CoverPlateType == "预制" ? ConstructionMethod.Precast : ConstructionMethod.CastInPlace
                    );
            else
                placeSlab.WhetherPlaceTiltSlab(
                   DgvSubsectionData.ReadDgvConvertSlabSubsection(this.dgv_Slot),
                   basicConstructor.CulvertBaseSlope * 0.01,
                   basicConstructor.CulvertGapWidth * 0.01,
                   basicConstructor.LeftLateralAngle,
                   basicConstructor.RightLateralAngle,
                   basicConstructor.PiecePly * 0.01,
                   CommonData.Instance.CommomTotal.CoverPlateType == "预制" ? ConstructionMethod.Precast : ConstructionMethod.CastInPlace
                   );
            #endregion

            //真实位置
            DTransform3d dTrans3d = new DTransform3d(CommonData.Instance.placePtDmatrix3d);
            dTrans3d.Translation = CommonData.Instance.culvertPlacePoint3d * GeneralBank.UorToMeters;
            TransformInfo dTransFormInfo = new TransformInfo(dTrans3d);

            Angle leftAngle = new Angle();
            leftAngle.Degrees = CommonData.Instance.CommomTotal.LeftAngle;
            Angle rightAngle = new Angle();
            rightAngle.Degrees = CommonData.Instance.CommomTotal.RightAngle;
            //rightAngle = Angle.FromDegrees(180 - CommonData.Instance.CommomTotal.RightAngle);
            double bpSlopeLeft = 0;
            double bpSlopeRight = 0;
            double heightLeft = 0;
            double heightRight = 0;
            if (CommonData.Instance.EntrancePointInfo.IsLeft)
            {
                bpSlopeLeft = CommonData.Instance.EntrancePointInfo.NormalSlope;
                bpSlopeRight = CommonData.Instance.ExitPointInfo.NormalSlope;
                if (this.rbt_EmbeddedIn.Checked)
                {
                    heightLeft = CommonData.Instance.CommonCulvertLengthSet.OverHeightIn;
                }
                if (this.rbt_InlineOut.Checked) //内嵌
                {
                    heightRight = CommonData.Instance.CommonCulvertLengthSet.OverHeightOut;
                }
            }
            else
            {
                bpSlopeLeft = CommonData.Instance.ExitPointInfo.NormalSlope;
                bpSlopeRight = CommonData.Instance.EntrancePointInfo.NormalSlope;
                if (this.rbt_InlineOut.Checked) //内嵌
                {
                    heightLeft = CommonData.Instance.CommonCulvertLengthSet.OverHeightOut;
                }
                if (this.rbt_EmbeddedIn.Checked)
                {
                    heightRight = CommonData.Instance.CommonCulvertLengthSet.OverHeightIn;
                }
            }

            #region 放置八字墙
            if (CommonData.Instance.CommomTotal.EntranceToCave.Left.Type == "八字墙")
            {
                //if (leftAngle.Degrees < 90)
                //{
                //    int obeyAngle = CommonData.Instance.AliformWall.AliformWallLeft.ObeyAngle;
                //    CommonData.Instance.AliformWall.AliformWallLeft.ObeyAngle = CommonData.Instance.AliformWall.AliformWallLeft.ContraryAngle;
                //    CommonData.Instance.AliformWall.AliformWallLeft.ContraryAngle = obeyAngle;
                //}
                //左侧八字墙
                AliformLeftStructures aliformLeftStructuresLeft = new AliformLeftStructures(
                CommonData.Instance.AliformWall.AliformWallLeft,
                "盖板涵",
                GeneralBank.ActiveDgnModel,
                1 / bpSlopeLeft,
                leftAngle,
                Convert.ToDouble(CommonData.Instance.CommomTotal.ClearSpanHeadroom.Split('×')[1].Trim()),
                basicConstructor.PiecePly * 0.01,
                Convert.ToDouble(CommonData.Instance.CommomTotal.ClearSpanHeadroom.Split('×')[0].Trim()),
                heightLeft
                );
                var elements = aliformLeftStructuresLeft.CreateAliformModel();
                Angle leftAngleWall = new Angle();
                leftAngleWall.Degrees = leftAngle.Degrees - 90;
                DTransform3d dTransform3D = DTransform3d.FromRotationAroundLine(DPoint3d.Zero, new DVector3d(0, 0, 1), leftAngleWall);
                dTransform3D.Translation = new DPoint3d(0, 0, -(Convert.ToDouble(CommonData.Instance.CommomTotal.ClearSpanHeadroom.Split('×')[1].Trim()) + basicConstructor.PiecePly * 0.01)) * GeneralBank.UorToMeters;
                TransformInfo transformInfoWall = new TransformInfo(dTransform3D);
                List<Bentley.DgnPlatformNET.Elements.Element> elementsWallLeft = new List<Bentley.DgnPlatformNET.Elements.Element>();
                foreach (var element in elements)
                {
                    var eleId = element.ElementId;
                    element.ApplyTransform(transformInfoWall);
                    element.ApplyTransform(dTransFormInfo);
                    elementsWallLeft.Add(element);
                    CommonData.Instance.ElementIds.Add(element.ElementId.ToString());
                }

                #region 八字墙剪切面
                Bentley.DgnPlatformNET.Convert1.ElementToBody(out SolidKernelEntity entityOut1, elements[0], true, false, false);
                SubEntity[] subEntities1;
                Bentley.DgnPlatformNET.SolidUtil.GetBodyVertices(out subEntities1, entityOut1);
                List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
                SolidUtil.EvaluateVertex(out DPoint3d startDP1, subEntities1[1]);
                SolidUtil.EvaluateVertex(out DPoint3d endDP1, subEntities1[subEntities1.Length - 2]);
                dPoint3Ds.Add(startDP1);
                dPoint3Ds.Add(endDP1);

                Bentley.DgnPlatformNET.Convert1.ElementToBody(out SolidKernelEntity entityOut2, elements[4], true, false, false);
                SubEntity[] subEntities2;
                Bentley.DgnPlatformNET.SolidUtil.GetBodyVertices(out subEntities2, entityOut2);
                SolidUtil.EvaluateVertex(out DPoint3d startDP2, subEntities2[2]);
                SolidUtil.EvaluateVertex(out DPoint3d endDP2, subEntities2[subEntities2.Length - 7]);

                dPoint3Ds.Add(startDP2);
                dPoint3Ds.Add(endDP2);
                dPoint3Ds.Add(startDP1);
                Bentley.DgnPlatformNET.Elements.ShapeElement crossProfileLeft = new Bentley.DgnPlatformNET.Elements.ShapeElement(GeneralHelpers.DefaultModel, null, dPoint3Ds.ToArray());
                crossProfileLeft.AddToModel();
                CreateLevel(crossProfileLeft);
                CommonData.Instance.ElementIds.Add(crossProfileLeft.ElementId.ToString());

                //临时剪切面
                DVector3d dVector3D = new DVector3d(startDP1, endDP2);
                dVector3D.NormalizeInPlace();
                dVector3D = dVector3D.RotateXY(Angle.FromDegrees(90));
                //DVector3d.UnitZ.CrossProduct(dVector3D).TryNormalize(out var leftNormalVector);
                DPoint3d pt1 = DPoint3d.Add(startDP1, dVector3D, 5 * GeneralBank.UorToMeters);
                DPoint3d pt2 = DPoint3d.Add(endDP2, dVector3D, 5 * GeneralBank.UorToMeters);
                List<DPoint3d> shapePts = new List<DPoint3d> { startDP1, endDP1, startDP2, endDP2, pt2, pt1 };
                Bentley.DgnPlatformNET.Elements.ShapeElement shapeL = new Bentley.DgnPlatformNET.Elements.ShapeElement(GeneralHelpers.DefaultModel, null, shapePts.ToArray());
                shapeL.AddToModel();
                CreateLevel(shapeL);
                CommonData.Instance.ElementIds.Add(shapeL.ElementId.ToString());
                #endregion
                CheccWingWall.AliformAddModels("盖板涵", true, elementsWallLeft);
                CommonData.Instance.ElementIds.AddRange(elementsWallLeft.Select(s => s.ElementId.ToString()));
            }
            if (CommonData.Instance.CommomTotal.EntranceToCave.Right.Type == "八字墙")
            {
                //左侧八字墙
                AliformRightStructures aliformRightStructuresLeft = new AliformRightStructures(
                CommonData.Instance.AliformWall.AliformWallRight,
                "盖板涵",
                GeneralBank.ActiveDgnModel,
                1 / bpSlopeRight,
                rightAngle,
                Convert.ToDouble(CommonData.Instance.CommomTotal.ClearSpanHeadroom.Split('×')[1].Trim()),
                basicConstructor.PiecePly * 0.01,
                Convert.ToDouble(CommonData.Instance.CommomTotal.ClearSpanHeadroom.Split('×')[0].Trim()),
                heightRight
                );
                var elements = aliformRightStructuresLeft.CreateAliformModel();
                Angle RightAngleWall = new Angle();
                RightAngleWall.Degrees = CommonData.Instance.CommomTotal.RightAngle - 90;
                double basicsLengthZ = basicsLength * basicConstructor.CulvertBaseSlope * 0.01;
                DPoint3d movePt = new DPoint3d(
                    basicsLength,
                    0,
                    -(Convert.ToDouble(CommonData.Instance.CommomTotal.ClearSpanHeadroom.Split('×')[1].Trim()) + basicConstructor.PiecePly * 0.01) + basicsLengthZ) * GeneralBank.UorToMeters;
                DTransform3d dTransform3D = DTransform3d.FromRotationAroundLine(DPoint3d.Zero, new DVector3d(0, 0, 1), RightAngleWall);
                dTransform3D.Translation = movePt;
                TransformInfo transformInfoWall = new TransformInfo(dTransform3D);
                List<Bentley.DgnPlatformNET.Elements.Element> elementsWallRight = new List<Bentley.DgnPlatformNET.Elements.Element>();
                foreach (var element in elements)
                {
                    var eleId = element.ElementId;
                    element.ApplyTransform(transformInfoWall);
                    element.ApplyTransform(dTransFormInfo);
                    elementsWallRight.Add(element);
                }
                #region 右侧八字墙剪切面
                Bentley.DgnPlatformNET.Convert1.ElementToBody(out SolidKernelEntity entityOut1, elements[0], true, false, false);
                SubEntity[] subEntities1;
                Bentley.DgnPlatformNET.SolidUtil.GetBodyVertices(out subEntities1, entityOut1);
                List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
                SolidUtil.EvaluateVertex(out DPoint3d startDP1, subEntities1[2]);
                SolidUtil.EvaluateVertex(out DPoint3d endDP1, subEntities1[subEntities1.Length - 7]);
                dPoint3Ds.Add(startDP1);
                dPoint3Ds.Add(endDP1);


                Bentley.DgnPlatformNET.Convert1.ElementToBody(out SolidKernelEntity entityOut2, elements[4], true, false, false);
                SubEntity[] subEntities2;
                Bentley.DgnPlatformNET.SolidUtil.GetBodyVertices(out subEntities2, entityOut2);
                SolidUtil.EvaluateVertex(out DPoint3d startDP2, subEntities2[1]);
                SolidUtil.EvaluateVertex(out DPoint3d endDP2, subEntities2[subEntities2.Length - 2]);
                dPoint3Ds.Add(startDP2);
                dPoint3Ds.Add(endDP2);
                dPoint3Ds.Add(startDP1);
                Bentley.DgnPlatformNET.Elements.ShapeElement crossProfileLeft = new Bentley.DgnPlatformNET.Elements.ShapeElement(GeneralHelpers.DefaultModel, null, dPoint3Ds.ToArray());
                crossProfileLeft.AddToModel();

                CreateLevel(crossProfileLeft);
                CommonData.Instance.ElementIds.Add(crossProfileLeft.ElementId.ToString());


                //临时剪切面
                DVector3d dVector3D = new DVector3d(endDP1, startDP2);
                dVector3D.NormalizeInPlace();
                dVector3D = dVector3D.RotateXY(Angle.FromDegrees(-90));
                //DVector3d.UnitZ.CrossProduct(dVector3D).TryNormalize(out var leftNormalVector);
                DPoint3d pt1 = DPoint3d.Add(endDP1, dVector3D, 5 * GeneralBank.UorToMeters);
                DPoint3d pt2 = DPoint3d.Add(startDP2, dVector3D, 5 * GeneralBank.UorToMeters);
                List<DPoint3d> shapePts = new List<DPoint3d> { endDP1, startDP1, endDP2, startDP2, pt2, pt1 };
                Bentley.DgnPlatformNET.Elements.ShapeElement shapeR = new Bentley.DgnPlatformNET.Elements.ShapeElement(GeneralHelpers.DefaultModel, null, shapePts.ToArray());
                shapeR.AddToModel();
                CreateLevel(shapeR);
                CommonData.Instance.ElementIds.Add(shapeR.ElementId.ToString());
                #endregion
                CheccWingWall.AliformAddModels("盖板涵", false, elementsWallRight);
                CommonData.Instance.ElementIds.AddRange(elementsWallRight.Select(s => s.ElementId.ToString()));
            }

            #endregion

            #region 放置锥坡
            if (CommonData.Instance.CommomTotal.EntranceToCave.Left.Type == "锥坡")
            {
                double LeftLateral = basicConstructor.ClearSpan / 2 + ((basicConstructor.ClearHeight + basicConstructor.PiecePly * 0.01) * Convert.ToDouble(this.cmb_OverallSlopeRatioLeft.Text)) * Math.Sin((basicConstructor.LeftLateralAngle) * Math.PI / 180);
                double LeftLateralOffset = LeftLateral * Math.Tan((90 - basicConstructor.LeftLateralAngle) * Math.PI / 180);
                double LeftLateralZ = LeftLateralOffset * basicConstructor.CulvertBaseSlope * 0.01;

                DPoint3d ptUp = new DPoint3d(LeftLateralOffset, LeftLateral, LeftLateralZ - (basicConstructor.ClearHeight + basicConstructor.PiecePly * 0.01)) * GeneralBank.UorToMeters;
                DPoint3d ptDown = new DPoint3d(-LeftLateralOffset, -LeftLateral, -LeftLateralZ - (basicConstructor.ClearHeight + basicConstructor.PiecePly * 0.01)) * GeneralBank.UorToMeters;

                Bentley.DgnPlatformNET.Elements.LineElement lineElement = new Bentley.DgnPlatformNET.Elements.LineElement(Session.Instance.GetActiveDgnModel(), null, new DSegment3d(ptUp, ptDown));
                lineElement.ApplyTransform(dTransFormInfo);
                lineElement.GetCurveVector().GetStartEnd(out DPoint3d staPt, out DPoint3d endPt);

                //Bentley.DgnPlatformNET.Elements.LineElement line = new Bentley.DgnPlatformNET.Elements.LineElement(Session.Instance.GetActiveDgnModel(), null,
                //    new DSegment3d(CommonData.Instance.CulverIntersectingLine.LinearGeometry.StartPoint.Coordinates * GeneralBank.UorToMeters, CommonData.Instance.CulverIntersectingLine.LinearGeometry.EndPoint.Coordinates * GeneralBank.UorToMeters));
                //line.AddToModel();
                ConicalSlopeLeft conicalSlopeLeft = new ConicalSlopeLeft(
                    CommonData.Instance.CulverIntersectingLine,
                    staPt * (1 / GeneralBank.UorToMeters),
                    endPt * (1 / GeneralBank.UorToMeters),
                    1 / bpSlopeLeft,
                    Convert.ToDouble(this.cmb_OverallSlopeRatioLeft.Text),
                    Convert.ToDouble(CommonData.Instance.CommomTotal.ClearSpanHeadroom.Split('×')[1].Trim()) + Convert.ToDouble(this.txt_UnitaryPiecePly.Text) * 0.01,
                    Session.Instance.GetActiveDgnModel(),
                    "盖板涵");
                var conicalObj = conicalSlopeLeft.CreateConicalSlope();
                CommonData.Instance.ElementIds.Add(conicalObj.cone_Lmin.ElementId.ToString());
                CommonData.Instance.ElementIds.Add(conicalObj.cone_Lmax.ElementId.ToString());
                Assemble.SetTableData("锥坡", "表层", "", SetCoverCulvertECProperty.GetVolume(conicalObj.cone_Lmin, Bentley.MstnPlatformNET.InteropServices.Utilities.ComApp), "m³");
                Assemble.SetTableData("锥坡", "表层", "", SetCoverCulvertECProperty.GetVolume(conicalObj.cone_Lmax, Bentley.MstnPlatformNET.InteropServices.Utilities.ComApp), "m³");

                Assemble.SetTableData("锥坡", GeneralHelpers.SerializeDatas.SlabCulvertData.ConicalSlope.Texture, "", GetConicalSlopeArea(conicalObj.cone_Lmin) + GetConicalSlopeArea(conicalObj.cone_Lmax), "m²");

                (Element cone_Lmax, Element cone_Lmin) = conicalSlopeLeft.CreateConicalSlopeBasics(CommonData.Instance.ConicalSlope.ConicalSlopeLeft.BaseDepth * 0.01);
                if (cone_Lmax != null)
                {
                    CommonData.Instance.ElementIds.Add(cone_Lmax.ElementId.ToString());
                    CommonData.Instance.ElementIds.Add(cone_Lmin.ElementId.ToString());
                    Assemble.SetTableData("锥坡", "基础", GeneralHelpers.GetCSVDatas("锥坡")["混凝土等级"], SetCoverCulvertECProperty.GetVolume(cone_Lmin, Bentley.MstnPlatformNET.InteropServices.Utilities.ComApp), "m³");
                    Assemble.SetTableData("锥坡", "基础", GeneralHelpers.GetCSVDatas("锥坡")["混凝土等级"], SetCoverCulvertECProperty.GetVolume(cone_Lmax, Bentley.MstnPlatformNET.InteropServices.Utilities.ComApp), "m³");
                }

                var wallObj = conicalSlopeLeft.CreatePaveAndCutoffWall(
                    CommonData.Instance.ConicalSlope.ConicalSlopeLeft.PaveThickness * 0.01,
                    CommonData.Instance.ConicalSlope.ConicalSlopeLeft.AddLenght * 0.01,
                    CommonData.Instance.ConicalSlope.ConicalSlopeLeft.CutoffWallHeight * 0.01,
                    CommonData.Instance.ConicalSlope.ConicalSlopeLeft.CutoffWallThickness * 0.01,
                    CommonData.Instance.ConicalSlope.ConicalSlopeLeft.EntranceCaveSlope * 0.01);
                CommonData.Instance.ElementIds.Add(wallObj.pave_L.ElementId.ToString());
                CommonData.Instance.ElementIds.Add(wallObj.cutoffWall_L.ElementId.ToString());
                Assemble.SetTableData("锥坡", GeneralHelpers.SerializeDatas.SlabCulvertData.Laid.Layer, GeneralHelpers.GetCSVDatas("锥坡")["混凝土等级"], SetCoverCulvertECProperty.GetVolume(cone_Lmin, Bentley.MstnPlatformNET.InteropServices.Utilities.ComApp), "m³");
                Assemble.SetTableData("锥坡", GeneralHelpers.SerializeDatas.SlabCulvertData.Laid.Layer, GeneralHelpers.GetCSVDatas("锥坡")["混凝土等级"], SetCoverCulvertECProperty.GetVolume(cone_Lmax, Bentley.MstnPlatformNET.InteropServices.Utilities.ComApp), "m³");
                ConicalSlopeShearFront(wallObj.pave_L, true);
            }

            if (CommonData.Instance.CommomTotal.EntranceToCave.Right.Type == "锥坡")
            {
                double RightLateral = basicConstructor.ClearSpan / 2 + ((basicConstructor.ClearHeight + basicConstructor.PiecePly * 0.01) * Convert.ToDouble(this.cmb_OverallSlopeRatioRight.Text)) * Math.Sin((basicConstructor.RightLateralAngle) * Math.PI / 180);
                double RightLateralOffset = RightLateral * Math.Tan((90 - basicConstructor.RightLateralAngle) * Math.PI / 180);
                double RightLateralZ = RightLateralOffset * basicConstructor.CulvertBaseSlope * 0.01;

                double basicsLengthZ = basicsLength * basicConstructor.CulvertBaseSlope * 0.01;
                DPoint3d ptUp = new DPoint3d(RightLateralOffset + basicsLength, RightLateral, RightLateralZ + basicsLengthZ - (basicConstructor.ClearHeight + basicConstructor.PiecePly * 0.01)) * GeneralBank.UorToMeters;
                DPoint3d ptDown = new DPoint3d(-RightLateralOffset + basicsLength, -RightLateral, -RightLateralZ + basicsLengthZ - (basicConstructor.ClearHeight + basicConstructor.PiecePly * 0.01)) * GeneralBank.UorToMeters;
                Bentley.DgnPlatformNET.Elements.LineElement lineElement = new Bentley.DgnPlatformNET.Elements.LineElement(Session.Instance.GetActiveDgnModel(), null, new DSegment3d(ptUp, ptDown));
                lineElement.ApplyTransform(dTransFormInfo);
                lineElement.GetCurveVector().GetStartEnd(out DPoint3d staPt, out DPoint3d endPt);

                ConicalSlopeRight conicalSlopeRight = new ConicalSlopeRight(
                    CommonData.Instance.CulverIntersectingLine,
                    staPt * (1 / GeneralBank.UorToMeters),
                    endPt * (1 / GeneralBank.UorToMeters),
                    1 / bpSlopeLeft,
                    Convert.ToDouble(this.cmb_OverallSlopeRatioLeft.Text),
                    Convert.ToDouble(CommonData.Instance.CommomTotal.ClearSpanHeadroom.Split('×')[1].Trim()) + Convert.ToDouble(this.txt_UnitaryPiecePly.Text) * 0.01,
                    Session.Instance.GetActiveDgnModel(),
                    "盖板涵");

                var conicalObj = conicalSlopeRight.CreateConicalSlope();
                CommonData.Instance.ElementIds.Add(conicalObj.cone_Lmin.ElementId.ToString());
                CommonData.Instance.ElementIds.Add(conicalObj.cone_Lmax.ElementId.ToString());
                Assemble.SetTableData("锥坡", "表层", "", SetCoverCulvertECProperty.GetVolume(conicalObj.cone_Lmin, Bentley.MstnPlatformNET.InteropServices.Utilities.ComApp), "m³");
                Assemble.SetTableData("锥坡", "表层", "", SetCoverCulvertECProperty.GetVolume(conicalObj.cone_Lmax, Bentley.MstnPlatformNET.InteropServices.Utilities.ComApp), "m³");

                Assemble.SetTableData("锥坡", GeneralHelpers.SerializeDatas.SlabCulvertData.ConicalSlope.Texture, "", GetConicalSlopeArea(conicalObj.cone_Lmin) + GetConicalSlopeArea(conicalObj.cone_Lmax), "m²");

                (Element cone_Rmax, Element cone_Rmin) = conicalSlopeRight.CreateConicalSlopeBasics(CommonData.Instance.ConicalSlope.ConicalSlopeRight.BaseDepth * 0.01);
                if (cone_Rmax != null)
                {
                    CommonData.Instance.ElementIds.Add(cone_Rmax.ElementId.ToString());
                    CommonData.Instance.ElementIds.Add(cone_Rmin.ElementId.ToString());
                    Assemble.SetTableData("锥坡", "基础", GeneralHelpers.GetCSVDatas("锥坡")["混凝土等级"], SetCoverCulvertECProperty.GetVolume(cone_Rmin, Bentley.MstnPlatformNET.InteropServices.Utilities.ComApp), "m³");
                    Assemble.SetTableData("锥坡", "基础", GeneralHelpers.GetCSVDatas("锥坡")["混凝土等级"], SetCoverCulvertECProperty.GetVolume(cone_Rmax, Bentley.MstnPlatformNET.InteropServices.Utilities.ComApp), "m³");
                }

                var wallObj = conicalSlopeRight.CreatePaveAndCutoffWall(
                    CommonData.Instance.ConicalSlope.ConicalSlopeRight.PaveThickness * 0.01,
                    CommonData.Instance.ConicalSlope.ConicalSlopeRight.AddLenght * 0.01,
                    CommonData.Instance.ConicalSlope.ConicalSlopeRight.CutoffWallHeight * 0.01,
                    CommonData.Instance.ConicalSlope.ConicalSlopeRight.CutoffWallThickness * 0.01,
                    CommonData.Instance.ConicalSlope.ConicalSlopeRight.EntranceCaveSlope * 0.01);
                CommonData.Instance.ElementIds.Add(wallObj.pave_R.ElementId.ToString());
                CommonData.Instance.ElementIds.Add(wallObj.cutoffWall_R.ElementId.ToString());
                Assemble.SetTableData("锥坡", GeneralHelpers.SerializeDatas.SlabCulvertData.Laid.Layer, GeneralHelpers.GetCSVDatas("锥坡")["混凝土等级"], SetCoverCulvertECProperty.GetVolume(cone_Rmin, Bentley.MstnPlatformNET.InteropServices.Utilities.ComApp), "m³");
                Assemble.SetTableData("锥坡", GeneralHelpers.SerializeDatas.SlabCulvertData.Laid.Layer, GeneralHelpers.GetCSVDatas("锥坡")["混凝土等级"], SetCoverCulvertECProperty.GetVolume(cone_Rmax, Bentley.MstnPlatformNET.InteropServices.Utilities.ComApp), "m³");
                ConicalSlopeShearFront(wallObj.pave_R, false);
            }
            #endregion

            #region 放置跌水井
            if (this.cmb_LeftCave.Text == "跌水井")
            {
                DropWell dropWell = new DropWell(CommonData.Instance.DropWell.LeftDropWell, CommonData.Instance.EndWall.EndWallLeft.Height, basicConstructor.PiecePly + basicConstructor.BasicsPly, basicConstructor.ClearSpan, basicConstructor.LeftLateralAngle);
                Bentley.DgnPlatformNET.Elements.Element dropWallLeft = dropWell.CreateEntityModel();

                double offsetZ = basicConstructor.PiecePly / 100 + basicConstructor.ClearHeight;
                //左侧变换
                DTransform3d.TryMirrorPointToPoint(new DPoint3d(-1, 0, 0), new DPoint3d(1, 0, 0), out DTransform3d transX);
                DTransform3d.TryMirrorPointToPoint(new DPoint3d(0, 1, 0), new DPoint3d(0, -1, 0), out DTransform3d transY);
                transX.Translation = new DPoint3d(0, 0, -offsetZ) * GeneralBank.UorToMeters;
                dropWallLeft.ApplyTransform(new TransformInfo(transX));
                dropWallLeft.ApplyTransform(new TransformInfo(transY));
                dropWallLeft.ApplyTransform(dTransFormInfo);
                dropWallLeft.AddToModel();
                CommonData.Instance.ElementIds.Add(dropWallLeft.ElementId.ToString());
            }
            if (this.cmb_RightCave.Text == "跌水井")
            {
                DropWell dropWell = new DropWell(CommonData.Instance.DropWell.RightDropWell, CommonData.Instance.EndWall.EndWallRight.Height, basicConstructor.PiecePly + basicConstructor.BasicsPly, basicConstructor.ClearSpan, basicConstructor.RightLateralAngle);
                Bentley.DgnPlatformNET.Elements.Element dropWallRight = dropWell.CreateEntityModel();

                double offsetZ = basicConstructor.PiecePly / 100 + basicConstructor.ClearHeight;
                //右侧变换
                DPoint3d movePt = new DPoint3d(basicsLength, 0, basicsLength * basicConstructor.CulvertBaseSlope / 100 - offsetZ) * GeneralBank.UorToMeters;
                DTransform3d trans = new DTransform3d(DMatrix3d.Identity);
                trans.Translation = movePt;
                dropWallRight.ApplyTransform(new TransformInfo(trans));
                dropWallRight.ApplyTransform(dTransFormInfo);
                dropWallRight.AddToModel();
                CommonData.Instance.ElementIds.Add(dropWallRight.ElementId.ToString());
            }
            #endregion

            #region 放置跌水
            if (this.cmb_LeftCave.Text == "跌水")
            {
                HeadFall headFall = new HeadFall(CommonData.Instance.HeadFall.LeftHeadFall, basicConstructor.ClearSpan, basicConstructor.LeftLateralAngle);
                Bentley.DgnPlatformNET.Elements.Element headFallEle = headFall.CreateEntityModel();
                double offsetZ = basicConstructor.PiecePly / 100 + basicConstructor.ClearHeight;
                //左侧变换
                DTransform3d.TryMirrorPointToPoint(new DPoint3d(-1, 0, 0), new DPoint3d(1, 0, 0), out DTransform3d transX);
                DTransform3d.TryMirrorPointToPoint(new DPoint3d(0, 1, 0), new DPoint3d(0, -1, 0), out DTransform3d transY);
                transX.Translation = new DPoint3d(0, 0, -offsetZ) * GeneralBank.UorToMeters;
                headFallEle.ApplyTransform(new TransformInfo(transX));
                headFallEle.ApplyTransform(new TransformInfo(transY));
                headFallEle.ApplyTransform(dTransFormInfo);
                headFallEle.AddToModel();
                CommonData.Instance.ElementIds.Add(headFallEle.ElementId.ToString());
            }
            if (this.cmb_RightCave.Text == "跌水")
            {
                HeadFall headFall = new HeadFall(CommonData.Instance.HeadFall.RightHeadFall, basicConstructor.ClearSpan, basicConstructor.RightLateralAngle);
                Bentley.DgnPlatformNET.Elements.Element headFallEle = headFall.CreateEntityModel();
                double offsetZ = basicConstructor.PiecePly / 100 + basicConstructor.ClearHeight;
                //右侧变换
                DPoint3d movePt = new DPoint3d(basicsLength, 0, basicsLength * basicConstructor.CulvertBaseSlope / 100 - offsetZ) * GeneralBank.UorToMeters;
                DTransform3d trans = new DTransform3d(DMatrix3d.Identity);
                trans.Translation = movePt;
                headFallEle.ApplyTransform(new TransformInfo(trans));
                headFallEle.ApplyTransform(dTransFormInfo);
                headFallEle.AddToModel();
                CommonData.Instance.ElementIds.Add(headFallEle.ElementId.ToString());
            }
            #endregion

            #region 放置排水槽
            if (this.cmb_LeftCave.Text == "排水槽")
            {
                Rhone rhone = new Rhone(CommonData.Instance.Rhone.LeftRhone, basicConstructor.ClearSpan, basicConstructor.LeftLateralAngle);
                Bentley.DgnPlatformNET.Elements.Element rhoneEle = rhone.CreateEntityModel();
                double offsetZ = basicConstructor.PiecePly / 100 + basicConstructor.ClearHeight;
                //左侧变换
                DTransform3d.TryMirrorPointToPoint(new DPoint3d(-1, 0, 0), new DPoint3d(1, 0, 0), out DTransform3d transX);
                DTransform3d.TryMirrorPointToPoint(new DPoint3d(0, 1, 0), new DPoint3d(0, -1, 0), out DTransform3d transY);
                transX.Translation = new DPoint3d(0, 0, -offsetZ) * GeneralBank.UorToMeters;
                rhoneEle.ApplyTransform(new TransformInfo(transX));
                rhoneEle.ApplyTransform(new TransformInfo(transY));
                rhoneEle.ApplyTransform(dTransFormInfo);
                rhoneEle.AddToModel();
                CommonData.Instance.ElementIds.Add(rhoneEle.ElementId.ToString());
            }
            if (this.cmb_RightCave.Text == "排水槽")
            {
                Rhone rhone = new Rhone(CommonData.Instance.Rhone.RightRhone, basicConstructor.ClearSpan, basicConstructor.RightLateralAngle);
                Bentley.DgnPlatformNET.Elements.Element rhoneEle = rhone.CreateEntityModel();
                double offsetZ = basicConstructor.PiecePly / 100 + basicConstructor.ClearHeight;
                //右侧变换
                DPoint3d movePt = new DPoint3d(basicsLength, 0, basicsLength * basicConstructor.CulvertBaseSlope / 100 - offsetZ) * GeneralBank.UorToMeters;
                DTransform3d trans = new DTransform3d(DMatrix3d.Identity);
                trans.Translation = movePt;
                rhoneEle.ApplyTransform(new TransformInfo(trans));
                rhoneEle.ApplyTransform(dTransFormInfo);
                rhoneEle.AddToModel();
                CommonData.Instance.ElementIds.Add(rhoneEle.ElementId.ToString());
            }
            #endregion

            #region 边沟跌水井 XHyu

            if (this.cmb_LeftCave.Text == "边沟跌井")
            {
                CreateSideDitchFallWell createSideDitchFallWell = new CreateSideDitchFallWell(CommonData.Instance.SideDitchFallWellLeft, CommonData.Instance.CommomTotal.ClearSpanHeadroom);
                List<Bentley.DgnPlatformNET.Elements.Element> entity = createSideDitchFallWell.CreateSideDitchFallWellBody(basicConstructor.LeftLateralAngle);
                double offsetZ = (
                    //CommonData.Instance.SideDitchFallWellLeft.SideDitchFallWell_ShaftBottomThickness +
                    Convert.ToDouble(txt_UnitaryBasicsPly.Text) +
                    CommonData.Instance.SideDitchFallWellLeft.SideDitchFallWell_ShaftDeep
                    ) / 100;
                //左侧变换
                DTransform3d.TryMirrorPointToPoint(new DPoint3d(-1, 0, 0), new DPoint3d(1, 0, 0), out DTransform3d transX);
                DTransform3d.TryMirrorPointToPoint(new DPoint3d(0, 1, 0), new DPoint3d(0, -1, 0), out DTransform3d transY);
                transX.Translation = new DPoint3d(0, 0, -offsetZ) * GeneralBank.UorToMeters;
                foreach (Bentley.DgnPlatformNET.Elements.Element element in entity)
                {
                    element.ApplyTransform(new TransformInfo(transX));
                    element.ApplyTransform(new TransformInfo(transY));
                    element.ApplyTransform(dTransFormInfo);
                    element.AddToModel();
                    CommonData.Instance.ElementIds.Add(element.ElementId.ToString());
                }


            }
            if (this.cmb_RightCave.Text == "边沟跌井")
            {
                CreateSideDitchFallWell createSideDitchFallWell = new CreateSideDitchFallWell(CommonData.Instance.SideDitchFallWellRight, CommonData.Instance.CommomTotal.ClearSpanHeadroom);
                List<Bentley.DgnPlatformNET.Elements.Element> entity = createSideDitchFallWell.CreateSideDitchFallWellBody(basicConstructor.RightLateralAngle);
                double offsetZ = (
                    //CommonData.Instance.SideDitchFallWellRight.SideDitchFallWell_ShaftBottomThickness +
                    //CommonData.Instance.SideDitchFallWellRight.SideDitchFallWell_GritBasinDeep +
                    Convert.ToDouble(txt_UnitaryBasicsPly.Text) +
                    CommonData.Instance.SideDitchFallWellRight.SideDitchFallWell_ShaftDeep
                    ) / 100;
                //double offsetZ = basicConstructor.PiecePly / 100 + basicConstructor.ClearHeight;
                //右侧变换
                DPoint3d movePt = new DPoint3d(basicsLength, 0, basicsLength * basicConstructor.CulvertBaseSlope / 100 - offsetZ) * GeneralBank.UorToMeters;
                DTransform3d trans = new DTransform3d(DMatrix3d.Identity);
                trans.Translation = movePt;
                foreach (Bentley.DgnPlatformNET.Elements.Element element in entity)
                {
                    element.ApplyTransform(new TransformInfo(trans));
                    element.ApplyTransform(dTransFormInfo);
                    element.AddToModel();
                    CommonData.Instance.ElementIds.Add(element.ElementId.ToString());
                }
            }
            #endregion

            #region 出口急流槽 LXhu

            if (this.cmb_LeftCave.Text == "出口急流槽")
            {
                ChuteOutStructure chuteOutStructureLeft = new ChuteOutStructure();
                chuteOutStructureLeft.CreateChuteOutStructure(CommonData.Instance.CommonChuteOut.LeftCommonChuteOut, CommonData.Instance.CommomTotal.LeftAngle, basicConstructor.ClearSpan, GeneralHelpers.Default3DModel);
                //左侧变换
                double offsetZ = basicConstructor.PiecePly / 100 + basicConstructor.ClearHeight;
                DTransform3d.TryMirrorPointToPoint(new DPoint3d(-1, 0, 0), new DPoint3d(1, 0, 0), out DTransform3d transX);
                DTransform3d.TryMirrorPointToPoint(new DPoint3d(0, 1, 0), new DPoint3d(0, -1, 0), out DTransform3d transY);
                transX.Translation = new DPoint3d(0, 0, -offsetZ) * GeneralBank.UorToMeters;
                foreach (Element element in chuteOutStructureLeft.Elements)
                {
                    element.ApplyTransform(new TransformInfo(transX));
                    element.ApplyTransform(new TransformInfo(transY));
                    element.ApplyTransform(dTransFormInfo);
                    element.AddToModel();
                    CommonData.Instance.ElementIds.Add(element.ElementId.ToString());
                }
            }
            if (this.cmb_RightCave.Text == "出口急流槽")
            {
                ChuteOutStructure chuteOutStructureRight = new ChuteOutStructure();
                chuteOutStructureRight.CreateChuteOutStructure(CommonData.Instance.CommonChuteOut.RightCommonChuteOut, CommonData.Instance.CommomTotal.RightAngle, basicConstructor.ClearSpan, GeneralHelpers.Default3DModel);
                double offsetZ = basicConstructor.PiecePly / 100 + basicConstructor.ClearHeight;
                //右侧变换
                DPoint3d movePt = new DPoint3d(basicsLength, 0, basicsLength * basicConstructor.CulvertBaseSlope / 100 - offsetZ) * GeneralBank.UorToMeters;
                DTransform3d trans = new DTransform3d(DMatrix3d.Identity);
                trans.Translation = movePt;
                foreach (Element element in chuteOutStructureRight.Elements)
                {
                    element.ApplyTransform(new TransformInfo(trans));
                    element.ApplyTransform(dTransFormInfo);
                    element.AddToModel();
                    CommonData.Instance.ElementIds.Add(element.ElementId.ToString());
                }
            }

            #endregion

            #region 进口急流槽 LXhu

            if (this.cmb_LeftCave.Text == "进口急流槽")
            {
                ChuteInStructure chuteInStructure = new ChuteInStructure();
                chuteInStructure.CreateChuteInStructure(
                    CommonData.Instance.CommonChuteIn.LeftCommonChuteIn,
                    basicConstructor.RightLateralAngle,
                    basicConstructor.ClearSpan,
                    0,
                    0,
                    GeneralHelpers.Default3DModel);
                //左侧变换
                double offsetZ = basicConstructor.PiecePly / 100 + basicConstructor.ClearHeight;
                DTransform3d.TryMirrorPointToPoint(new DPoint3d(-1, 0, 0), new DPoint3d(1, 0, 0), out DTransform3d transX);
                DTransform3d.TryMirrorPointToPoint(new DPoint3d(0, 1, 0), new DPoint3d(0, -1, 0), out DTransform3d transY);
                transX.Translation = new DPoint3d(0, 0, -offsetZ) * GeneralBank.UorToMeters;
                foreach (Element element in chuteInStructure.Elements)
                {
                    element.ApplyTransform(new TransformInfo(transX));
                    element.ApplyTransform(new TransformInfo(transY));
                    element.ApplyTransform(dTransFormInfo);
                    element.AddToModel();
                    CommonData.Instance.ElementIds.Add(element.ElementId.ToString());
                }
            }
            if (this.cmb_RightCave.Text == "进口急流槽")
            {
                ChuteInStructure chuteInStructure = new ChuteInStructure();
                chuteInStructure.CreateChuteInStructure(
                    CommonData.Instance.CommonChuteIn.RightCommonChuteIn,
                    basicConstructor.LeftLateralAngle,
                    basicConstructor.ClearSpan,
                    0,
                    0,
                    GeneralHelpers.Default3DModel);
                double offsetZ = basicConstructor.PiecePly / 100 + basicConstructor.ClearHeight;
                //右侧变换
                DPoint3d movePt = new DPoint3d(basicsLength, 0, basicsLength * basicConstructor.CulvertBaseSlope / 100 - offsetZ) * GeneralBank.UorToMeters;
                DTransform3d trans = new DTransform3d(DMatrix3d.Identity);
                trans.Translation = movePt;
                foreach (Element element in chuteInStructure.Elements)
                {
                    element.ApplyTransform(new TransformInfo(trans));
                    element.ApplyTransform(dTransFormInfo);
                    element.AddToModel();
                    CommonData.Instance.ElementIds.Add(element.ElementId.ToString());
                }
            }

            #endregion

            //涵底标识线
            LinearEntity2dInPlan linearEntity2DInPlan = CommonData.Instance.CulverIntersectingLine.DomainObject as LinearEntity2dInPlan;
            DPoint3d staPT = linearEntity2DInPlan.ActiveLinearEntity3d.BaseGeometry.StartPoint.PointOnExtension;
            DPoint3d endPT = linearEntity2DInPlan.ActiveLinearEntity3d.BaseGeometry.EndPoint.PointOnExtension;

            double height = basicConstructor.PiecePly * 0.01 + basicConstructor.ClearHeight;
            staPT.Z = staPT.Z - height;
            endPT.Z = endPT.Z - height;
            Bentley.DgnPlatformNET.Elements.LineElement showLine = new Bentley.DgnPlatformNET.Elements.LineElement(GeneralBank.Default3DModel, null, new DSegment3d(staPT * GeneralBank.UorToMeters, endPT * GeneralBank.UorToMeters));
            showLine.AddToModel();
            CommonData.Instance.ElementIds.Add(showLine.ElementId.ToString());

            //删除涵洞线
            Bentley.CifNET.GeometryModel.SDK.Alignment alignment = AlignmentProperty.seachTagetAlignment(CommonData.Instance.CulverIntersectingLine);
            if (alignment != null)
            {
                if (alignment.ActiveLinearEntity3d != null) alignment.ActiveLinearEntity3d.Element.DeleteFromModel();
            }
            CommonData.Instance.CulverIntersectingLine.Element.DeleteFromModel();
        }

        /// <summary>
        /// 计算植草面积
        /// </summary>
        /// <param name="element">锥体</param>
        /// <returns>植草面积</returns>
        private double GetConicalSlopeArea(Element element)
        {
            Bentley.DgnPlatformNET.Convert1.ElementToBody(out SolidKernelEntity entityOut, element, true, false, false);
            SolidUtil.GetBodyFaces(out SubEntity[] subEntitiesOut, entityOut);
            double area = 0;
            Convert1.SubEntityToCurveVector(out CurveVector curvesOut, subEntitiesOut[0]);
            //curvesOut.CentroidAreaXY(out DPoint3d centroid, out area);
            curvesOut.CentroidNormalArea(out DPoint3d centroid2, out DVector3d normal, out area);
            // 换算单位㎡
            area /= 10000;
            area /= 10000;
            return area;
        }


        /// <summary>
        /// 锥坡剪切面
        /// </summary>
        /// <param name="pave_L">铺砌元素</param>
        private static void ConicalSlopeShearFront(Bentley.DgnPlatformNET.Elements.Element pave_L, bool isLeft)
        {
            Bentley.DgnPlatformNET.Convert1.ElementToBody(out SolidKernelEntity entityOut1, pave_L, true, false, false);
            SubEntity[] subEntities1;
            Bentley.DgnPlatformNET.SolidUtil.GetBodyVertices(out subEntities1, entityOut1);
            List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
            SolidUtil.EvaluateVertex(out DPoint3d startDP1, subEntities1[0]);
            SolidUtil.EvaluateVertex(out DPoint3d endDP1, subEntities1[1]);
            dPoint3Ds.Add(startDP1);
            dPoint3Ds.Add(endDP1);


            Bentley.DgnPlatformNET.Convert1.ElementToBody(out SolidKernelEntity entityOut2, pave_L, true, false, false);
            SubEntity[] subEntities2;
            Bentley.DgnPlatformNET.SolidUtil.GetBodyVertices(out subEntities2, entityOut2);
            SolidUtil.EvaluateVertex(out DPoint3d startDP2, subEntities2[2]);
            SolidUtil.EvaluateVertex(out DPoint3d endDP2, subEntities2[3]);
            dPoint3Ds.Add(endDP2);
            dPoint3Ds.Add(startDP2);

            dPoint3Ds.Add(startDP1);
            Bentley.DgnPlatformNET.Elements.ShapeElement crossProfileLeft = new Bentley.DgnPlatformNET.Elements.ShapeElement(GeneralHelpers.DefaultModel, null, dPoint3Ds.ToArray());
            crossProfileLeft.AddToModel();
            CreateLevel(crossProfileLeft);
            CommonData.Instance.ElementIds.Add(crossProfileLeft.ElementId.ToString());


            //临时剪切面
            DVector3d dVector3D = new DVector3d(endDP2, endDP1);
            dVector3D.NormalizeInPlace();
            dVector3D = dVector3D.RotateXY(Angle.FromDegrees(isLeft == true ? 90 : -90));
            //DVector3d.UnitZ.CrossProduct(dVector3D).TryNormalize(out var leftNormalVector);
            DPoint3d pt1 = DPoint3d.Add(endDP2, dVector3D, 5 * GeneralBank.UorToMeters);
            DPoint3d pt2 = DPoint3d.Add(endDP1, dVector3D, 5 * GeneralBank.UorToMeters);
            List<DPoint3d> shapePts = new List<DPoint3d> { endDP2, startDP2, startDP1, endDP1, pt2, pt1 };
            Bentley.DgnPlatformNET.Elements.ShapeElement shapeR = new Bentley.DgnPlatformNET.Elements.ShapeElement(GeneralHelpers.DefaultModel, null, shapePts.ToArray());
            shapeR.AddToModel();
            CreateLevel(shapeR);
            CommonData.Instance.ElementIds.Add(shapeR.ElementId.ToString());
        }

        public static void CreateLevel(Bentley.DgnPlatformNET.Elements.ShapeElement element)
        {
            // 获取指定名层
            DgnFile dgnfile = Session.Instance.GetActiveDgnFile();
            FileLevelCache lvlCache = dgnfile.GetLevelCache();
            LevelHandle lvlHandle = lvlCache.GetLevelByName("涵洞剪切面");
            if (!lvlHandle.IsValid)//当前文件中不存在时创建
            {
                EditLevelHandle editLevelHandle = lvlCache.CreateLevel("涵洞剪切面");
                editLevelHandle.SetByLevelColor(new LevelDefinitionColor(3, dgnfile));

                lvlCache.Write();
                lvlHandle = lvlCache.GetLevelByName("涵洞剪切面");
            }
            //设置元素的层属性写入模型中
            ElementPropertiesSetter eleSet = new ElementPropertiesSetter();
            eleSet.SetLevel(lvlHandle.LevelId);
            eleSet.SetColor(3);
            eleSet.Apply(element);
            element.ReplaceInModel(element);
        }

        private void CreateSeparatingBasic()
        {
            //根据沉降缝计算分度涵长
            List<double> culvertLenLists = DgvSubsectionData.ReadDgvConvertSectionSubsection(this.dgv_Slot);

            //涵身钢筋数据
            RebarEntity rebarData = SetDataGridViewData(CommonData.Instance.CommomTotal.GeneralDiagram, CommonData.Instance.CommomTotal.ClearSpanHeadroom, CommonData.Instance.CommomTotal.FillValue);

            //获取涵身构造参数
            BasicConstructor basicConstructor = new BasicConstructor
            {
                CulvertLenLists = culvertLenLists,
                BracingBeamLength = rebarData.BracingBeamLength,
                BracingBeamHeight = rebarData.BracingBeamHeight,
                BracingBeamWidth = rebarData.BracingBeamWidth,
                BracingBeamInterval = rebarData.BracingBeamInterval,
                LeftLateralAngle = CommonData.Instance.CommomTotal.LeftAngle,
                RightLateralAngle = CommonData.Instance.CommomTotal.RightAngle,
                CulvertGapWidth = Convert.ToDouble(this.txt_SedimentationWidth.Text),
                BaseGapWidth = Convert.ToDouble(this.txt_BaseWidth.Text),
                CulvertBaseSlope = CommonData.Instance.CommomTotal.Slope,
                ClearSpan = Convert.ToDouble(CommonData.Instance.CommomTotal.ClearSpanHeadroom.Split('×')[0].Trim()),
                ClearHeight = Convert.ToDouble(CommonData.Instance.CommomTotal.ClearSpanHeadroom.Split('×')[1].Trim()),
                PiecePly = Convert.ToDouble(this.txt_SeparatingPiecePly.Text),
                BasicsEdge = Convert.ToDouble(this.txt_SeparatingBasics.Text),
                StandPly = Convert.ToDouble(this.txt_SeparatingStandPly.Text),
                BasicWidth = Convert.ToDouble(txt_SeparatingBasicWidth.Text),
                StandTopWidth = Convert.ToDouble(this.txt_SeparatingStandTopWidth.Text),
                BasicsPly = Convert.ToDouble(this.txt_SeparatingBasicsPly.Text)
            };
            CommonData.Instance.basicConstructor = basicConstructor;
            CommonData.Instance.culvertLenLists = culvertLenLists;
            CommonData.Instance.replaceMent = replaceMent;

            double basicsLength = culvertLenLists.Take(culvertLenLists.Count).Sum() / 100;
            for (int i = 0; i < culvertLenLists.Count; i++)
            {
                basicConstructor.BasicsLength = culvertLenLists[i];
                if (i == 0)
                {
                    FactoryCreator separatingBasicFactory = new SeparatingBasicLeftFactory();
                    ConstructingEntity constructingEntity = separatingBasicFactory.ConstructingEntityCreator(basicConstructor, CulvertType.SlabCulvert, ConstructionMethod.CastInPlace, CulvertComponentType.CulvertBody);
                    constructingEntity.distanceFromStart = culvertLenLists.Take(i).Sum() / 100;
                    constructingEntity.dMatrix3D = CommonData.Instance.placePtDmatrix3d;
                    constructingEntity.placeDpoint3d = CommonData.Instance.culvertPlacePoint3d;
                    constructingEntity.CreateEntityModel();
                }
                else if (i == culvertLenLists.Count - 1)
                {
                    FactoryCreator separatingBasicFactory = new SeparatingBasicRightFactory();
                    ConstructingEntity constructingEntity = separatingBasicFactory.ConstructingEntityCreator(basicConstructor, CulvertType.SlabCulvert, ConstructionMethod.CastInPlace, CulvertComponentType.CulvertBody);
                    constructingEntity.distanceFromStart = culvertLenLists.Take(i).Sum() / 100;
                    constructingEntity.dMatrix3D = CommonData.Instance.placePtDmatrix3d;
                    constructingEntity.placeDpoint3d = CommonData.Instance.culvertPlacePoint3d;
                    constructingEntity.CreateEntityModel();
                }
                else
                {
                    FactoryCreator separatingBasicFactory = new SeparatingBasicFactory();
                    ConstructingEntity constructingEntity = separatingBasicFactory.ConstructingEntityCreator(basicConstructor, CulvertType.SlabCulvert, ConstructionMethod.CastInPlace, CulvertComponentType.CulvertBody);
                    constructingEntity.distanceFromStart = culvertLenLists.Take(i).Sum() / 100;
                    constructingEntity.dMatrix3D = CommonData.Instance.placePtDmatrix3d;
                    constructingEntity.placeDpoint3d = CommonData.Instance.culvertPlacePoint3d;
                    constructingEntity.CreateEntityModel();
                }
            }
            //支撑梁
            if (this.rbt_SeparatingSupport.Checked)
            {
                FactoryCreator separatingBasicFactory = new BracingBeamFactory(rebarData);
                ConstructingEntity constructingEntity = separatingBasicFactory.ConstructingEntityCreator(basicConstructor, CulvertType.SlabCulvert, ConstructionMethod.Precast, CulvertComponentType.BraceSummer);
                constructingEntity.distanceFromStart = 0;
                constructingEntity.dMatrix3D = CommonData.Instance.placePtDmatrix3d;
                constructingEntity.placeDpoint3d = CommonData.Instance.culvertPlacePoint3d;
                constructingEntity.CreateEntityModel();
            }
            //换填
            if (cb_IsExchangeFill.Checked)
            {
                FactoryCreator separatingBasicFactory = new ReplaceMentFactory();
                ConstructingEntity constructingEntity = separatingBasicFactory.ConstructingEntityCreator(basicConstructor, CulvertType.SlabCulvert, ConstructionMethod.CastInPlace, CulvertComponentType.Fondation);
                constructingEntity.distanceFromStart = 0;
                constructingEntity.keyValuePairs = replaceMent;
                constructingEntity.basicType = BasicType.SeparatingBasic;
                constructingEntity.dMatrix3D = CommonData.Instance.placePtDmatrix3d;
                constructingEntity.placeDpoint3d = CommonData.Instance.culvertPlacePoint3d;
                constructingEntity.CreateEntityModel();
            }


            //左侧端墙
            if (this.cmb_LeftHeadWall.Text == "设置")
            {
                FactoryCreator endWallFactory = new EndWallFactory(CommonData.Instance.EndWall.EndWallLeft, CommonData.Instance.CapStone.CapStoneLeft, CapLocation.Left, basicsLength);
                ConstructingEntity endWallEntity = endWallFactory.ConstructingEntityCreator(basicConstructor, CulvertType.SlabCulvert, ConstructionMethod.Precast, CulvertComponentType.OrthogonalityCover);
                endWallEntity.dMatrix3D = CommonData.Instance.placePtDmatrix3d;
                endWallEntity.placeDpoint3d = CommonData.Instance.culvertPlacePoint3d;
                endWallEntity.CreateEntityModel();
            }
            //右侧端墙
            if (this.cmb_LeftHeadWall.Text == "设置")
            {
                FactoryCreator endWallFactoryR = new EndWallFactory(CommonData.Instance.EndWall.EndWallRight, CommonData.Instance.CapStone.CapStoneRight, CapLocation.Right, basicsLength);
                ConstructingEntity endWallEntityR = endWallFactoryR.ConstructingEntityCreator(basicConstructor, CulvertType.SlabCulvert, ConstructionMethod.Precast, CulvertComponentType.OrthogonalityCover);
                endWallEntityR.dMatrix3D = CommonData.Instance.placePtDmatrix3d;
                endWallEntityR.placeDpoint3d = CommonData.Instance.culvertPlacePoint3d;
                endWallEntityR.CreateEntityModel();
            }

            #region 放置盖板
            /*
             10为盖板角度，正盖板为空，角度需要涵身斜角减去90度
             */
            Dictionary<string, List<string>> keyValuePairs = GetCellNameToModelName(CommonData.Instance.CommomTotal.GeneralDiagram, CommonData.Instance.CommomTotal.FillValue, CommonData.Instance.CommomTotal.ClearSpanHeadroom, 0, null, this.cmb_CoverplateType.Text == "预制" ? ConstructionScheme.Precast : ConstructionScheme.CastInPlace, CulvertFoundationType.FrontCover);
            Dictionary<string, List<string>> keyValuePairsLeft = GetCellNameToModelName(CommonData.Instance.CommomTotal.GeneralDiagram, CommonData.Instance.CommomTotal.FillValue, CommonData.Instance.CommomTotal.ClearSpanHeadroom, Math.Abs(90 - CommonData.Instance.CommomTotal.LeftAngle), InclinedPlate.Left, this.cmb_CoverplateType.Text == "预制" ? ConstructionScheme.Precast : ConstructionScheme.CastInPlace, CulvertFoundationType.InclinedCover);
            Dictionary<string, List<string>> keyValuePairsRight = GetCellNameToModelName(CommonData.Instance.CommomTotal.GeneralDiagram, CommonData.Instance.CommomTotal.FillValue, CommonData.Instance.CommomTotal.ClearSpanHeadroom, Math.Abs(90 - CommonData.Instance.CommomTotal.RightAngle), InclinedPlate.Right, this.cmb_CoverplateType.Text == "预制" ? ConstructionScheme.Precast : ConstructionScheme.CastInPlace, CulvertFoundationType.InclinedCover);
            string cellName = string.Empty;
            string leftCellName = string.Empty;
            string rightCellName = string.Empty;
            for (int i = 0; i < keyValuePairs.Keys.Count; i++)
            {
                for (int k = 0; k < keyValuePairs.ElementAt(i).Value.Count; k++)
                {
                    if (keyValuePairs.ElementAt(i).Value[k].ToString() == this.cmb_CoverplateModel.Text)
                    {
                        cellName = keyValuePairs.ElementAt(i).Key.ToString();
                    }
                }
            }
            for (int i = 0; i < keyValuePairsLeft.Keys.Count; i++)
            {
                for (int k = 0; k < keyValuePairsLeft.ElementAt(i).Value.Count; k++)
                {
                    if (keyValuePairsLeft.ElementAt(i).Value[k].ToString() == this.cmb_LeftCoverplateModel.Text)
                    {
                        leftCellName = keyValuePairsLeft.ElementAt(i).Key.ToString();
                    }
                }
            }
            for (int i = 0; i < keyValuePairsRight.Keys.Count; i++)
            {
                for (int k = 0; k < keyValuePairsRight.ElementAt(i).Value.Count; k++)
                {
                    if (keyValuePairsRight.ElementAt(i).Value[k].ToString() == this.cmb_RightCoverplateModel.Text)
                    {
                        rightCellName = keyValuePairsRight.ElementAt(i).Key.ToString();
                    }
                }
            }
            //放置盖板
            PlaceSlab placeSlab = new PlaceSlab(
                this.cmb_LeftCoverplateModel.Text,
                leftCellName,
                this.cmb_CoverplateModel.Text,
                cellName,
                this.cmb_RightCoverplateModel.Text,
                rightCellName,
                CommonData.Instance.placePtDmatrix3d,
                CommonData.Instance.culvertPlacePoint3d
                );

            //是否采用通用图
            if (CommonData.Instance.CommomTotal.WhetherGeneralDiagram == "是")
                placeSlab.PlaceTiltSlab(
                DgvSubsectionData.ReadDgvConvertSlabSubsection(this.dgv_Slot),
                basicConstructor.CulvertBaseSlope * 0.01,
                basicConstructor.CulvertGapWidth * 0.01,
                basicConstructor.LeftLateralAngle,
                basicConstructor.RightLateralAngle,
                basicConstructor.PiecePly * 0.01,
                this.cmb_CoverplateType.Text == "预制" ? ConstructionMethod.Precast : ConstructionMethod.CastInPlace
                );
            else
                placeSlab.WhetherPlaceTiltSlab(
               DgvSubsectionData.ReadDgvConvertSlabSubsection(this.dgv_Slot),
               basicConstructor.CulvertBaseSlope * 0.01,
               basicConstructor.CulvertGapWidth * 0.01,
               basicConstructor.LeftLateralAngle,
               basicConstructor.RightLateralAngle,
               basicConstructor.PiecePly * 0.01,
               this.cmb_CoverplateType.Text == "预制" ? ConstructionMethod.Precast : ConstructionMethod.CastInPlace
               );
            #endregion

            //真实位置
            DTransform3d dTrans3d = new DTransform3d(CommonData.Instance.placePtDmatrix3d);
            dTrans3d.Translation = CommonData.Instance.culvertPlacePoint3d * GeneralBank.UorToMeters;
            TransformInfo dTransFormInfo = new TransformInfo(dTrans3d);

            Angle leftAngle = new Angle();
            leftAngle.Degrees = CommonData.Instance.CommomTotal.LeftAngle;
            Angle rightAngle = new Angle();
            rightAngle.Degrees = CommonData.Instance.CommomTotal.RightAngle;
            double bpSlopeLeft = 0;
            double bpSlopeRight = 0;
            double heightLeft = 0;
            double heightRight = 0;
            if (CommonData.Instance.EntrancePointInfo.IsLeft)
            {
                bpSlopeLeft = CommonData.Instance.EntrancePointInfo.NormalSlope;
                bpSlopeRight = CommonData.Instance.ExitPointInfo.NormalSlope;
                if (this.rbt_EmbeddedIn.Checked)
                {
                    heightLeft = Convert.ToDouble(this.txt_OverHeightIn.Text);
                }
                if (this.rbt_InlineOut.Checked) //内嵌
                {
                    heightRight = Convert.ToDouble(this.txt_OverHeightOut.Text);
                }
            }
            else
            {
                bpSlopeLeft = CommonData.Instance.ExitPointInfo.NormalSlope;
                bpSlopeRight = CommonData.Instance.EntrancePointInfo.NormalSlope;
                if (this.rbt_InlineOut.Checked) //内嵌
                {
                    heightLeft = Convert.ToDouble(this.txt_OverHeightOut.Text);
                }
                if (this.rbt_EmbeddedIn.Checked)
                {
                    heightRight = Convert.ToDouble(this.txt_OverHeightIn.Text);
                }
            }

            #region 放置八字墙
            if (this.cmb_LeftCave.Text == "八字墙")
            {
                //if (leftAngle.Degrees < 90)
                //{
                //    int obeyAngle = CommonData.Instance.AliformWall.AliformWallLeft.ObeyAngle;
                //    CommonData.Instance.AliformWall.AliformWallLeft.ObeyAngle = CommonData.Instance.AliformWall.AliformWallLeft.ContraryAngle;
                //    CommonData.Instance.AliformWall.AliformWallLeft.ContraryAngle = obeyAngle;
                //}
                //左侧八字墙
                AliformLeftStructures aliformLeftStructuresLeft = new AliformLeftStructures(
                CommonData.Instance.AliformWall.AliformWallLeft,
                "盖板涵",
                GeneralBank.ActiveDgnModel,
                1 / bpSlopeLeft,
                leftAngle,
                Convert.ToDouble(CommonData.Instance.CommomTotal.ClearSpanHeadroom.Split('×')[1].Trim()),
                Convert.ToDouble(this.txt_UnitaryPiecePly.Text) * 0.01,
                Convert.ToDouble(CommonData.Instance.CommomTotal.ClearSpanHeadroom.Split('×')[0].Trim()),
                heightLeft
                );
                var elements = aliformLeftStructuresLeft.CreateAliformModel();
                Angle leftAngleWall = new Angle();
                leftAngleWall.Degrees = leftAngle.Degrees - 90;
                DTransform3d dTransform3D = DTransform3d.FromRotationAroundLine(DPoint3d.Zero, new DVector3d(0, 0, 1), leftAngleWall);
                dTransform3D.Translation = new DPoint3d(0, 0, -(Convert.ToDouble(CommonData.Instance.CommomTotal.ClearSpanHeadroom.Split('×')[1].Trim()) + Convert.ToDouble(this.txt_UnitaryPiecePly.Text) * 0.01)) * GeneralBank.UorToMeters;
                TransformInfo transformInfoWall = new TransformInfo(dTransform3D);
                List<Bentley.DgnPlatformNET.Elements.Element> elementsWallLeft = new List<Bentley.DgnPlatformNET.Elements.Element>();
                foreach (var element in elements)
                {
                    var eleId = element.ElementId;
                    element.ApplyTransform(transformInfoWall);
                    element.ApplyTransform(dTransFormInfo);
                    elementsWallLeft.Add(element);
                }

                #region 八字墙剪切面
                Bentley.DgnPlatformNET.Convert1.ElementToBody(out SolidKernelEntity entityOut1, elements[0], true, false, false);
                SubEntity[] subEntities1;
                Bentley.DgnPlatformNET.SolidUtil.GetBodyVertices(out subEntities1, entityOut1);
                List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
                SolidUtil.EvaluateVertex(out DPoint3d startDP1, subEntities1[1]);
                SolidUtil.EvaluateVertex(out DPoint3d endDP1, subEntities1[subEntities1.Length - 2]);
                dPoint3Ds.Add(startDP1);
                dPoint3Ds.Add(endDP1);

                Bentley.DgnPlatformNET.Convert1.ElementToBody(out SolidKernelEntity entityOut2, elements[4], true, false, false);
                SubEntity[] subEntities2;
                Bentley.DgnPlatformNET.SolidUtil.GetBodyVertices(out subEntities2, entityOut2);
                SolidUtil.EvaluateVertex(out DPoint3d startDP2, subEntities2[2]);
                SolidUtil.EvaluateVertex(out DPoint3d endDP2, subEntities2[subEntities2.Length - 7]);

                dPoint3Ds.Add(startDP2);
                dPoint3Ds.Add(endDP2);
                dPoint3Ds.Add(startDP1);
                Bentley.DgnPlatformNET.Elements.ShapeElement crossProfileLeft = new Bentley.DgnPlatformNET.Elements.ShapeElement(GeneralHelpers.DefaultModel, null, dPoint3Ds.ToArray());
                crossProfileLeft.AddToModel();
                CreateLevel(crossProfileLeft);
                CommonData.Instance.ElementIds.Add(crossProfileLeft.ElementId.ToString());

                //临时剪切面
                DVector3d dVector3D = new DVector3d(startDP1, endDP2);
                dVector3D.NormalizeInPlace();
                dVector3D = dVector3D.RotateXY(Angle.FromDegrees(90));
                //DVector3d.UnitZ.CrossProduct(dVector3D).TryNormalize(out var leftNormalVector);
                DPoint3d pt1 = DPoint3d.Add(startDP1, dVector3D, 5 * GeneralBank.UorToMeters);
                DPoint3d pt2 = DPoint3d.Add(endDP2, dVector3D, 5 * GeneralBank.UorToMeters);
                List<DPoint3d> shapePts = new List<DPoint3d> { startDP1, endDP1, startDP2, endDP2, pt2, pt1 };
                Bentley.DgnPlatformNET.Elements.ShapeElement shapeL = new Bentley.DgnPlatformNET.Elements.ShapeElement(GeneralHelpers.DefaultModel, null, shapePts.ToArray());
                shapeL.AddToModel();
                CreateLevel(shapeL);
                CommonData.Instance.ElementIds.Add(shapeL.ElementId.ToString());
                #endregion
                CheccWingWall.AliformAddModels("盖板涵", true, elementsWallLeft);
                CommonData.Instance.ElementIds.AddRange(elementsWallLeft.Select(s => s.ElementId.ToString()));
            }
            if (this.cmb_RightCave.Text == "八字墙")
            {
                //左侧八字墙
                AliformRightStructures aliformRightStructuresLeft = new AliformRightStructures(
                CommonData.Instance.AliformWall.AliformWallRight,
                "盖板涵",
                GeneralBank.ActiveDgnModel,
                1 / bpSlopeRight,
                rightAngle,
                Convert.ToDouble(CommonData.Instance.CommomTotal.ClearSpanHeadroom.Split('×')[1].Trim()),
                Convert.ToDouble(this.txt_UnitaryPiecePly.Text) * 0.01,
                Convert.ToDouble(CommonData.Instance.CommomTotal.ClearSpanHeadroom.Split('×')[0].Trim()),
                heightRight
                );
                var elements = aliformRightStructuresLeft.CreateAliformModel();
                Angle RightAngleWall = new Angle();
                RightAngleWall.Degrees = CommonData.Instance.CommomTotal.RightAngle - 90;
                double basicsLengthZ = basicsLength * basicConstructor.CulvertBaseSlope * 0.01;
                DPoint3d movePt = new DPoint3d(
                    basicsLength,
                    0,
                    -(Convert.ToDouble(CommonData.Instance.CommomTotal.ClearSpanHeadroom.Split('×')[1].Trim()) + Convert.ToDouble(this.txt_UnitaryPiecePly.Text) * 0.01) + basicsLengthZ) * GeneralBank.UorToMeters;
                DTransform3d dTransform3D = DTransform3d.FromRotationAroundLine(DPoint3d.Zero, new DVector3d(0, 0, 1), RightAngleWall);
                dTransform3D.Translation = movePt;
                TransformInfo transformInfoWall = new TransformInfo(dTransform3D);
                List<Bentley.DgnPlatformNET.Elements.Element> elementsWallRight = new List<Bentley.DgnPlatformNET.Elements.Element>();
                foreach (var element in elements)
                {
                    var eleId = element.ElementId;
                    element.ApplyTransform(transformInfoWall);
                    element.ApplyTransform(dTransFormInfo);
                    elementsWallRight.Add(element);
                }
                #region 右侧八字墙剪切面
                Bentley.DgnPlatformNET.Convert1.ElementToBody(out SolidKernelEntity entityOut1, elements[0], true, false, false);
                SubEntity[] subEntities1;
                Bentley.DgnPlatformNET.SolidUtil.GetBodyVertices(out subEntities1, entityOut1);
                List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
                SolidUtil.EvaluateVertex(out DPoint3d startDP1, subEntities1[2]);
                SolidUtil.EvaluateVertex(out DPoint3d endDP1, subEntities1[subEntities1.Length - 7]);
                dPoint3Ds.Add(startDP1);
                dPoint3Ds.Add(endDP1);


                Bentley.DgnPlatformNET.Convert1.ElementToBody(out SolidKernelEntity entityOut2, elements[4], true, false, false);
                SubEntity[] subEntities2;
                Bentley.DgnPlatformNET.SolidUtil.GetBodyVertices(out subEntities2, entityOut2);
                SolidUtil.EvaluateVertex(out DPoint3d startDP2, subEntities2[1]);
                SolidUtil.EvaluateVertex(out DPoint3d endDP2, subEntities2[subEntities2.Length - 2]);
                dPoint3Ds.Add(startDP2);
                dPoint3Ds.Add(endDP2);
                dPoint3Ds.Add(startDP1);
                Bentley.DgnPlatformNET.Elements.ShapeElement crossProfileLeft = new Bentley.DgnPlatformNET.Elements.ShapeElement(GeneralHelpers.DefaultModel, null, dPoint3Ds.ToArray());
                crossProfileLeft.AddToModel();

                CreateLevel(crossProfileLeft);
                CommonData.Instance.ElementIds.Add(crossProfileLeft.ElementId.ToString());


                //临时剪切面
                DVector3d dVector3D = new DVector3d(endDP1, startDP2);
                dVector3D.NormalizeInPlace();
                dVector3D = dVector3D.RotateXY(Angle.FromDegrees(-90));
                //DVector3d.UnitZ.CrossProduct(dVector3D).TryNormalize(out var leftNormalVector);
                DPoint3d pt1 = DPoint3d.Add(endDP1, dVector3D, 5 * GeneralBank.UorToMeters);
                DPoint3d pt2 = DPoint3d.Add(startDP2, dVector3D, 5 * GeneralBank.UorToMeters);
                List<DPoint3d> shapePts = new List<DPoint3d> { endDP1, startDP1, endDP2, startDP2, pt2, pt1 };
                Bentley.DgnPlatformNET.Elements.ShapeElement shapeR = new Bentley.DgnPlatformNET.Elements.ShapeElement(GeneralHelpers.DefaultModel, null, shapePts.ToArray());
                shapeR.AddToModel();
                CreateLevel(shapeR);
                CommonData.Instance.ElementIds.Add(shapeR.ElementId.ToString());
                #endregion
                CheccWingWall.AliformAddModels("盖板涵", false, elementsWallRight);
                CommonData.Instance.ElementIds.AddRange(elementsWallRight.Select(s => s.ElementId.ToString()));
            }

            #endregion

            #region 放置锥坡
            if (this.cmb_LeftCave.Text == "锥坡")
            {
                double LeftLateral = basicConstructor.ClearSpan / 2 + ((basicConstructor.ClearHeight + basicConstructor.PiecePly * 0.01) * Convert.ToDouble(this.cmb_OverallSlopeRatioLeft.Text)) * Math.Sin((basicConstructor.LeftLateralAngle) * Math.PI / 180);
                double LeftLateralOffset = LeftLateral * Math.Tan((90 - basicConstructor.LeftLateralAngle) * Math.PI / 180);
                double LeftLateralZ = LeftLateralOffset * basicConstructor.CulvertBaseSlope * 0.01;

                DPoint3d ptUp = new DPoint3d(LeftLateralOffset, LeftLateral, LeftLateralZ - (basicConstructor.ClearHeight + basicConstructor.PiecePly * 0.01)) * GeneralBank.UorToMeters;
                DPoint3d ptDown = new DPoint3d(-LeftLateralOffset, -LeftLateral, -LeftLateralZ - (basicConstructor.ClearHeight + basicConstructor.PiecePly * 0.01)) * GeneralBank.UorToMeters;

                Bentley.DgnPlatformNET.Elements.LineElement lineElement = new Bentley.DgnPlatformNET.Elements.LineElement(Session.Instance.GetActiveDgnModel(), null, new DSegment3d(ptUp, ptDown));
                lineElement.ApplyTransform(dTransFormInfo);
                lineElement.GetCurveVector().GetStartEnd(out DPoint3d staPt, out DPoint3d endPt);

                //Bentley.DgnPlatformNET.Elements.LineElement line = new Bentley.DgnPlatformNET.Elements.LineElement(Session.Instance.GetActiveDgnModel(), null,
                //    new DSegment3d(CommonData.Instance.CulverIntersectingLine.LinearGeometry.StartPoint.Coordinates * GeneralBank.UorToMeters, CommonData.Instance.CulverIntersectingLine.LinearGeometry.EndPoint.Coordinates * GeneralBank.UorToMeters));
                //line.AddToModel();
                ConicalSlopeLeft conicalSlopeLeft = new ConicalSlopeLeft(
                    CommonData.Instance.CulverIntersectingLine,
                    staPt * (1 / GeneralBank.UorToMeters),
                    endPt * (1 / GeneralBank.UorToMeters),
                    1 / bpSlopeLeft,
                    Convert.ToDouble(this.cmb_OverallSlopeRatioLeft.Text),
                    Convert.ToDouble(CommonData.Instance.CommomTotal.ClearSpanHeadroom.Split('×')[1].Trim()) + Convert.ToDouble(this.txt_UnitaryPiecePly.Text) * 0.01,
                    Session.Instance.GetActiveDgnModel(),
                    "盖板涵");
                var conicalObj = conicalSlopeLeft.CreateConicalSlope();
                CommonData.Instance.ElementIds.Add(conicalObj.cone_Lmin.ElementId.ToString());
                CommonData.Instance.ElementIds.Add(conicalObj.cone_Lmax.ElementId.ToString());

                (Element cone_Lmax, Element cone_Lmin) = conicalSlopeLeft.CreateConicalSlopeBasics(CommonData.Instance.ConicalSlope.ConicalSlopeLeft.BaseDepth * 0.01);
                if (cone_Lmax != null)
                {
                    CommonData.Instance.ElementIds.Add(cone_Lmax.ElementId.ToString());
                    CommonData.Instance.ElementIds.Add(cone_Lmin.ElementId.ToString());
                }

                var wallObj = conicalSlopeLeft.CreatePaveAndCutoffWall(
                    CommonData.Instance.ConicalSlope.ConicalSlopeLeft.PaveThickness * 0.01,
                    CommonData.Instance.ConicalSlope.ConicalSlopeLeft.AddLenght * 0.01,
                    CommonData.Instance.ConicalSlope.ConicalSlopeLeft.CutoffWallHeight * 0.01,
                    CommonData.Instance.ConicalSlope.ConicalSlopeLeft.CutoffWallThickness * 0.01,
                    CommonData.Instance.ConicalSlope.ConicalSlopeLeft.EntranceCaveSlope * 0.01);
                CommonData.Instance.ElementIds.Add(wallObj.pave_L.ElementId.ToString());
                CommonData.Instance.ElementIds.Add(wallObj.cutoffWall_L.ElementId.ToString());
                ConicalSlopeShearFront(wallObj.pave_L, true);
            }

            if (this.cmb_RightCave.Text == "锥坡")
            {
                double RightLateral = basicConstructor.ClearSpan / 2 + ((basicConstructor.ClearHeight + basicConstructor.PiecePly * 0.01) * Convert.ToDouble(this.cmb_OverallSlopeRatioRight.Text)) * Math.Sin((basicConstructor.RightLateralAngle) * Math.PI / 180);
                double RightLateralOffset = RightLateral * Math.Tan((90 - basicConstructor.RightLateralAngle) * Math.PI / 180);
                double RightLateralZ = RightLateralOffset * basicConstructor.CulvertBaseSlope * 0.01;

                double basicsLengthZ = basicsLength * basicConstructor.CulvertBaseSlope * 0.01;
                DPoint3d ptUp = new DPoint3d(RightLateralOffset + basicsLength, RightLateral, RightLateralZ + basicsLengthZ - (basicConstructor.ClearHeight + basicConstructor.PiecePly * 0.01)) * GeneralBank.UorToMeters;
                DPoint3d ptDown = new DPoint3d(-RightLateralOffset + basicsLength, -RightLateral, -RightLateralZ + basicsLengthZ - (basicConstructor.ClearHeight + basicConstructor.PiecePly * 0.01)) * GeneralBank.UorToMeters;
                Bentley.DgnPlatformNET.Elements.LineElement lineElement = new Bentley.DgnPlatformNET.Elements.LineElement(Session.Instance.GetActiveDgnModel(), null, new DSegment3d(ptUp, ptDown));
                lineElement.ApplyTransform(dTransFormInfo);
                lineElement.GetCurveVector().GetStartEnd(out DPoint3d staPt, out DPoint3d endPt);

                ConicalSlopeRight conicalSlopeRight = new ConicalSlopeRight(
                    CommonData.Instance.CulverIntersectingLine,
                    staPt * (1 / GeneralBank.UorToMeters),
                    endPt * (1 / GeneralBank.UorToMeters),
                    1 / bpSlopeLeft,
                    Convert.ToDouble(this.cmb_OverallSlopeRatioLeft.Text),
                    Convert.ToDouble(CommonData.Instance.CommomTotal.ClearSpanHeadroom.Split('×')[1].Trim()) + Convert.ToDouble(this.txt_UnitaryPiecePly.Text) * 0.01,
                    Session.Instance.GetActiveDgnModel(),
                    "盖板涵");

                var conicalObj = conicalSlopeRight.CreateConicalSlope();
                CommonData.Instance.ElementIds.Add(conicalObj.cone_Lmin.ElementId.ToString());
                CommonData.Instance.ElementIds.Add(conicalObj.cone_Lmax.ElementId.ToString());

                (Element cone_Lmax, Element cone_Lmin) = conicalSlopeRight.CreateConicalSlopeBasics(CommonData.Instance.ConicalSlope.ConicalSlopeRight.BaseDepth * 0.01);
                if (cone_Lmax != null)
                {
                    CommonData.Instance.ElementIds.Add(cone_Lmax.ElementId.ToString());
                    CommonData.Instance.ElementIds.Add(cone_Lmin.ElementId.ToString());
                }

                var wallObj = conicalSlopeRight.CreatePaveAndCutoffWall(
                    CommonData.Instance.ConicalSlope.ConicalSlopeRight.PaveThickness * 0.01,
                    CommonData.Instance.ConicalSlope.ConicalSlopeRight.AddLenght * 0.01,
                    CommonData.Instance.ConicalSlope.ConicalSlopeRight.CutoffWallHeight * 0.01,
                    CommonData.Instance.ConicalSlope.ConicalSlopeRight.CutoffWallThickness * 0.01,
                    CommonData.Instance.ConicalSlope.ConicalSlopeRight.EntranceCaveSlope * 0.01);
                CommonData.Instance.ElementIds.Add(wallObj.pave_R.ElementId.ToString());
                CommonData.Instance.ElementIds.Add(wallObj.cutoffWall_R.ElementId.ToString());
                ConicalSlopeShearFront(wallObj.pave_R, false);
            }
            #endregion

            #region 放置跌水井
            if (this.cmb_LeftCave.Text == "跌水井")
            {
                DropWell dropWell = new DropWell(CommonData.Instance.DropWell.LeftDropWell, CommonData.Instance.EndWall.EndWallLeft.Height, basicConstructor.PiecePly + basicConstructor.BasicsPly, basicConstructor.ClearSpan, basicConstructor.LeftLateralAngle);
                Bentley.DgnPlatformNET.Elements.Element dropWallLeft = dropWell.CreateEntityModel();

                double offsetZ = basicConstructor.PiecePly / 100 + basicConstructor.ClearHeight;
                //左侧变换
                DTransform3d.TryMirrorPointToPoint(new DPoint3d(-1, 0, 0), new DPoint3d(1, 0, 0), out DTransform3d transX);
                DTransform3d.TryMirrorPointToPoint(new DPoint3d(0, 1, 0), new DPoint3d(0, -1, 0), out DTransform3d transY);
                transX.Translation = new DPoint3d(0, 0, -offsetZ) * GeneralBank.UorToMeters;
                dropWallLeft.ApplyTransform(new TransformInfo(transX));
                dropWallLeft.ApplyTransform(new TransformInfo(transY));
                dropWallLeft.ApplyTransform(dTransFormInfo);
                dropWallLeft.AddToModel();
                CommonData.Instance.ElementIds.Add(dropWallLeft.ElementId.ToString());
            }
            if (this.cmb_RightCave.Text == "跌水井")
            {
                DropWell dropWell = new DropWell(CommonData.Instance.DropWell.RightDropWell, CommonData.Instance.EndWall.EndWallRight.Height, basicConstructor.PiecePly + basicConstructor.BasicsPly, basicConstructor.ClearSpan, basicConstructor.RightLateralAngle);
                Bentley.DgnPlatformNET.Elements.Element dropWallRight = dropWell.CreateEntityModel();

                double offsetZ = basicConstructor.PiecePly / 100 + basicConstructor.ClearHeight;
                //右侧变换
                DPoint3d movePt = new DPoint3d(basicsLength, 0, basicsLength * basicConstructor.CulvertBaseSlope / 100 - offsetZ) * GeneralBank.UorToMeters;
                DTransform3d trans = new DTransform3d(DMatrix3d.Identity);
                trans.Translation = movePt;
                dropWallRight.ApplyTransform(new TransformInfo(trans));
                dropWallRight.ApplyTransform(dTransFormInfo);
                dropWallRight.AddToModel();
                CommonData.Instance.ElementIds.Add(dropWallRight.ElementId.ToString());
            }
            #endregion

            #region 放置跌水
            if (this.cmb_LeftCave.Text == "跌水")
            {
                HeadFall headFall = new HeadFall(CommonData.Instance.HeadFall.LeftHeadFall, basicConstructor.ClearSpan, basicConstructor.LeftLateralAngle);
                Bentley.DgnPlatformNET.Elements.Element headFallEle = headFall.CreateEntityModel();
                double offsetZ = basicConstructor.PiecePly / 100 + basicConstructor.ClearHeight;
                //左侧变换
                DTransform3d.TryMirrorPointToPoint(new DPoint3d(-1, 0, 0), new DPoint3d(1, 0, 0), out DTransform3d transX);
                DTransform3d.TryMirrorPointToPoint(new DPoint3d(0, 1, 0), new DPoint3d(0, -1, 0), out DTransform3d transY);
                transX.Translation = new DPoint3d(0, 0, -offsetZ) * GeneralBank.UorToMeters;
                headFallEle.ApplyTransform(new TransformInfo(transX));
                headFallEle.ApplyTransform(new TransformInfo(transY));
                headFallEle.ApplyTransform(dTransFormInfo);
                headFallEle.AddToModel();
                CommonData.Instance.ElementIds.Add(headFallEle.ElementId.ToString());
            }
            if (this.cmb_RightCave.Text == "跌水")
            {
                HeadFall headFall = new HeadFall(CommonData.Instance.HeadFall.RightHeadFall, basicConstructor.ClearSpan, basicConstructor.RightLateralAngle);
                Bentley.DgnPlatformNET.Elements.Element headFallEle = headFall.CreateEntityModel();
                double offsetZ = basicConstructor.PiecePly / 100 + basicConstructor.ClearHeight;
                //右侧变换
                DPoint3d movePt = new DPoint3d(basicsLength, 0, basicsLength * basicConstructor.CulvertBaseSlope / 100 - offsetZ) * GeneralBank.UorToMeters;
                DTransform3d trans = new DTransform3d(DMatrix3d.Identity);
                trans.Translation = movePt;
                headFallEle.ApplyTransform(new TransformInfo(trans));
                headFallEle.ApplyTransform(dTransFormInfo);
                headFallEle.AddToModel();
                CommonData.Instance.ElementIds.Add(headFallEle.ElementId.ToString());
            }
            #endregion

            #region 放置排水槽
            if (this.cmb_LeftCave.Text == "排水槽")
            {
                Rhone rhone = new Rhone(CommonData.Instance.Rhone.LeftRhone, basicConstructor.ClearSpan, basicConstructor.LeftLateralAngle);
                Bentley.DgnPlatformNET.Elements.Element rhoneEle = rhone.CreateEntityModel();
                double offsetZ = basicConstructor.PiecePly / 100 + basicConstructor.ClearHeight;
                //左侧变换
                DTransform3d.TryMirrorPointToPoint(new DPoint3d(-1, 0, 0), new DPoint3d(1, 0, 0), out DTransform3d transX);
                DTransform3d.TryMirrorPointToPoint(new DPoint3d(0, 1, 0), new DPoint3d(0, -1, 0), out DTransform3d transY);
                transX.Translation = new DPoint3d(0, 0, -offsetZ) * GeneralBank.UorToMeters;
                rhoneEle.ApplyTransform(new TransformInfo(transX));
                rhoneEle.ApplyTransform(new TransformInfo(transY));
                rhoneEle.ApplyTransform(dTransFormInfo);
                rhoneEle.AddToModel();
                CommonData.Instance.ElementIds.Add(rhoneEle.ElementId.ToString());
            }
            if (this.cmb_RightCave.Text == "排水槽")
            {
                Rhone rhone = new Rhone(CommonData.Instance.Rhone.RightRhone, basicConstructor.ClearSpan, basicConstructor.RightLateralAngle);
                Bentley.DgnPlatformNET.Elements.Element rhoneEle = rhone.CreateEntityModel();
                double offsetZ = basicConstructor.PiecePly / 100 + basicConstructor.ClearHeight;
                //右侧变换
                DPoint3d movePt = new DPoint3d(basicsLength, 0, basicsLength * basicConstructor.CulvertBaseSlope / 100 - offsetZ) * GeneralBank.UorToMeters;
                DTransform3d trans = new DTransform3d(DMatrix3d.Identity);
                trans.Translation = movePt;
                rhoneEle.ApplyTransform(new TransformInfo(trans));
                rhoneEle.ApplyTransform(dTransFormInfo);
                rhoneEle.AddToModel();
                CommonData.Instance.ElementIds.Add(rhoneEle.ElementId.ToString());
            }
            #endregion

            #region 边沟跌水井 XHyu

            if (this.cmb_LeftCave.Text == "边沟跌井")
            {
                CreateSideDitchFallWell createSideDitchFallWell = new CreateSideDitchFallWell(CommonData.Instance.SideDitchFallWellLeft, CommonData.Instance.CommomTotal.ClearSpanHeadroom);
                List<Bentley.DgnPlatformNET.Elements.Element> entity = createSideDitchFallWell.CreateSideDitchFallWellBody(basicConstructor.LeftLateralAngle);
                double offsetZ = (
                    //CommonData.Instance.SideDitchFallWellLeft.SideDitchFallWell_ShaftBottomThickness +
                    Convert.ToDouble(txt_UnitaryBasicsPly.Text) +
                    CommonData.Instance.SideDitchFallWellLeft.SideDitchFallWell_ShaftDeep
                    ) / 100;
                //左侧变换
                DTransform3d.TryMirrorPointToPoint(new DPoint3d(-1, 0, 0), new DPoint3d(1, 0, 0), out DTransform3d transX);
                DTransform3d.TryMirrorPointToPoint(new DPoint3d(0, 1, 0), new DPoint3d(0, -1, 0), out DTransform3d transY);
                transX.Translation = new DPoint3d(0, 0, -offsetZ) * GeneralBank.UorToMeters;
                foreach (Bentley.DgnPlatformNET.Elements.Element element in entity)
                {
                    element.ApplyTransform(new TransformInfo(transX));
                    element.ApplyTransform(new TransformInfo(transY));
                    element.ApplyTransform(dTransFormInfo);
                    element.AddToModel();
                    CommonData.Instance.ElementIds.Add(element.ElementId.ToString());
                }


            }
            if (this.cmb_RightCave.Text == "边沟跌井")
            {
                CreateSideDitchFallWell createSideDitchFallWell = new CreateSideDitchFallWell(CommonData.Instance.SideDitchFallWellRight, CommonData.Instance.CommomTotal.ClearSpanHeadroom);
                List<Bentley.DgnPlatformNET.Elements.Element> entity = createSideDitchFallWell.CreateSideDitchFallWellBody(basicConstructor.RightLateralAngle);
                double offsetZ = (
                    //CommonData.Instance.SideDitchFallWellRight.SideDitchFallWell_ShaftBottomThickness +
                    //CommonData.Instance.SideDitchFallWellRight.SideDitchFallWell_GritBasinDeep +
                    Convert.ToDouble(txt_UnitaryBasicsPly.Text) +
                    CommonData.Instance.SideDitchFallWellRight.SideDitchFallWell_ShaftDeep
                    ) / 100;
                //double offsetZ = basicConstructor.PiecePly / 100 + basicConstructor.ClearHeight;
                //右侧变换
                DPoint3d movePt = new DPoint3d(basicsLength, 0, basicsLength * basicConstructor.CulvertBaseSlope / 100 - offsetZ) * GeneralBank.UorToMeters;
                DTransform3d trans = new DTransform3d(DMatrix3d.Identity);
                trans.Translation = movePt;
                foreach (Bentley.DgnPlatformNET.Elements.Element element in entity)
                {
                    element.ApplyTransform(new TransformInfo(trans));
                    element.ApplyTransform(dTransFormInfo);
                    element.AddToModel();
                    CommonData.Instance.ElementIds.Add(element.ElementId.ToString());
                }
            }
            #endregion

            #region 出口急流槽 LXhu

            if (this.cmb_LeftCave.Text == "出口急流槽")
            {
                ChuteOutStructure chuteOutStructureLeft = new ChuteOutStructure();
                chuteOutStructureLeft.CreateChuteOutStructure(CommonData.Instance.CommonChuteOut.LeftCommonChuteOut, CommonData.Instance.CommomTotal.LeftAngle, basicConstructor.ClearSpan, GeneralHelpers.Default3DModel);
                //左侧变换
                double offsetZ = basicConstructor.PiecePly / 100 + basicConstructor.ClearHeight;
                DTransform3d.TryMirrorPointToPoint(new DPoint3d(-1, 0, 0), new DPoint3d(1, 0, 0), out DTransform3d transX);
                DTransform3d.TryMirrorPointToPoint(new DPoint3d(0, 1, 0), new DPoint3d(0, -1, 0), out DTransform3d transY);
                transX.Translation = new DPoint3d(0, 0, -offsetZ) * GeneralBank.UorToMeters;
                foreach (Element element in chuteOutStructureLeft.Elements)
                {
                    element.ApplyTransform(new TransformInfo(transX));
                    element.ApplyTransform(new TransformInfo(transY));
                    element.ApplyTransform(dTransFormInfo);
                    element.AddToModel();
                    CommonData.Instance.ElementIds.Add(element.ElementId.ToString());
                }
            }
            if (this.cmb_RightCave.Text == "出口急流槽")
            {
                ChuteOutStructure chuteOutStructureRight = new ChuteOutStructure();
                chuteOutStructureRight.CreateChuteOutStructure(CommonData.Instance.CommonChuteOut.RightCommonChuteOut, CommonData.Instance.CommomTotal.RightAngle, basicConstructor.ClearSpan, GeneralHelpers.Default3DModel);
                double offsetZ = basicConstructor.PiecePly / 100 + basicConstructor.ClearHeight;
                //右侧变换
                DPoint3d movePt = new DPoint3d(basicsLength, 0, basicsLength * basicConstructor.CulvertBaseSlope / 100 - offsetZ) * GeneralBank.UorToMeters;
                DTransform3d trans = new DTransform3d(DMatrix3d.Identity);
                trans.Translation = movePt;
                foreach (Element element in chuteOutStructureRight.Elements)
                {
                    element.ApplyTransform(new TransformInfo(trans));
                    element.ApplyTransform(dTransFormInfo);
                    element.AddToModel();
                    CommonData.Instance.ElementIds.Add(element.ElementId.ToString());
                }
            }

            #endregion

            #region 进口急流槽 LXhu

            if (this.cmb_LeftCave.Text == "进口急流槽")
            {
                ChuteInStructure chuteInStructure = new ChuteInStructure();
                chuteInStructure.CreateChuteInStructure(
                    CommonData.Instance.CommonChuteIn.LeftCommonChuteIn,
                    basicConstructor.RightLateralAngle,
                    basicConstructor.ClearSpan,
                    0,
                    0,
                    GeneralHelpers.Default3DModel);
                //左侧变换
                double offsetZ = basicConstructor.PiecePly / 100 + basicConstructor.ClearHeight;
                DTransform3d.TryMirrorPointToPoint(new DPoint3d(-1, 0, 0), new DPoint3d(1, 0, 0), out DTransform3d transX);
                DTransform3d.TryMirrorPointToPoint(new DPoint3d(0, 1, 0), new DPoint3d(0, -1, 0), out DTransform3d transY);
                transX.Translation = new DPoint3d(0, 0, -offsetZ) * GeneralBank.UorToMeters;
                foreach (Element element in chuteInStructure.Elements)
                {
                    element.ApplyTransform(new TransformInfo(transX));
                    element.ApplyTransform(new TransformInfo(transY));
                    element.ApplyTransform(dTransFormInfo);
                    element.AddToModel();
                    CommonData.Instance.ElementIds.Add(element.ElementId.ToString());
                }
            }
            if (this.cmb_RightCave.Text == "进口急流槽")
            {
                ChuteInStructure chuteInStructure = new ChuteInStructure();
                chuteInStructure.CreateChuteInStructure(
                    CommonData.Instance.CommonChuteIn.RightCommonChuteIn,
                    basicConstructor.LeftLateralAngle,
                    basicConstructor.ClearSpan,
                    0,
                    0,
                    GeneralHelpers.Default3DModel);
                double offsetZ = basicConstructor.PiecePly / 100 + basicConstructor.ClearHeight;
                //右侧变换
                DPoint3d movePt = new DPoint3d(basicsLength, 0, basicsLength * basicConstructor.CulvertBaseSlope / 100 - offsetZ) * GeneralBank.UorToMeters;
                DTransform3d trans = new DTransform3d(DMatrix3d.Identity);
                trans.Translation = movePt;
                foreach (Element element in chuteInStructure.Elements)
                {
                    element.ApplyTransform(new TransformInfo(trans));
                    element.ApplyTransform(dTransFormInfo);
                    element.AddToModel();
                    CommonData.Instance.ElementIds.Add(element.ElementId.ToString());
                }
            }

            #endregion

            //涵底标识线
            LinearEntity2dInPlan linearEntity2DInPlan = CommonData.Instance.CulverIntersectingLine.DomainObject as LinearEntity2dInPlan;
            DPoint3d staPT = linearEntity2DInPlan.ActiveLinearEntity3d.BaseGeometry.StartPoint.PointOnExtension;
            DPoint3d endPT = linearEntity2DInPlan.ActiveLinearEntity3d.BaseGeometry.EndPoint.PointOnExtension;

            double height = basicConstructor.PiecePly * 0.01 + basicConstructor.ClearHeight;
            staPT.Z = staPT.Z - height;
            endPT.Z = endPT.Z - height;
            Bentley.DgnPlatformNET.Elements.LineElement showLine = new Bentley.DgnPlatformNET.Elements.LineElement(GeneralBank.Default3DModel, null, new DSegment3d(staPT * GeneralBank.UorToMeters, endPT * GeneralBank.UorToMeters));
            showLine.AddToModel();
            CommonData.Instance.ElementIds.Add(showLine.ElementId.ToString());

            //删除涵洞线
            Bentley.CifNET.GeometryModel.SDK.Alignment alignment = AlignmentProperty.seachTagetAlignment(CommonData.Instance.CulverIntersectingLine);
            if (alignment != null)
            {
                if (alignment.ActiveLinearEntity3d != null) alignment.ActiveLinearEntity3d.Element.DeleteFromModel();
            }
            CommonData.Instance.CulverIntersectingLine.Element.DeleteFromModel();
        }

        private void btn_Rebar_Click(object sender, EventArgs e)
        {
            UnitaryRebarForm unitaryRebarForm = new UnitaryRebarForm(CommonData.Instance.CommomTotal.GeneralDiagram, CommonData.Instance.CommomTotal.ClearSpanHeadroom, CommonData.Instance.CommomTotal.FillValue, this.cmb_UnitaryProtectiveLayer.Text);//如果已经销毁，则重新创建子窗口对象
            unitaryRebarForm.StartPosition = FormStartPosition.CenterScreen;
            unitaryRebarForm.TopMost = true;
            unitaryRebarForm.Show();
        }
        private double GetAngleByStep(double angle, double angleStep)
        {
            double remainder = angle % angleStep;
            double integerSection = Math.Floor(angle / angleStep);
            if (remainder >= angleStep / 2)
            {
                return (integerSection + 1) * angleStep;
            }
            else
            {
                return integerSection * angleStep;
            }
        }

        /// <summary>
        /// 获取涵洞交线与边坡关联 信息
        /// </summary>
        public void GetCulvertAlignmentInfo()
        {
            GetDesignAlignment();
            Alignment alignment = CommonData.Instance.CulverIntersectingLine;
            if (this.rbt_automaticCal.Checked)
            {
                DVector3d entranceVector3D = CommonData.Instance.EntrancePointInfo.VectorByLayLine;
                DVector3d ExitVector3D = CommonData.Instance.ExitPointInfo.VectorByLayLine;
                DPoint3d staPt = alignment.LinearGeometry.StartPoint.Coordinates;
                DPoint3d endPt = alignment.LinearGeometry.EndPoint.Coordinates;
                Angle entranceAngle = entranceVector3D.AngleTo(new DVector3d(staPt, endPt));
                Angle exitAngle = ExitVector3D.AngleTo(new DVector3d(staPt, endPt));
                CommonData.Instance.EntranceAngle = entranceAngle;
                CommonData.Instance.ExitAngle = exitAngle;
            }
            //虚拟涵长
            CommonData.Instance.VirtualCulvertLength = CommonData.Instance.EntrancePointInfo.PointOnLayLine.Distance(
                new DPoint3d(CommonData.Instance.ExitPointInfo.PointOnLayLine.X,
                CommonData.Instance.ExitPointInfo.PointOnLayLine.Y,
                CommonData.Instance.EntrancePointInfo.PointOnLayLine.Z));
            CommonData.Instance.VirtualCulvertLength = Math.Round(CommonData.Instance.VirtualCulvertLength, 4);
            if (CommonData.Instance.EntrancePointInfo.IsLeft) //是否为进水口
            {
                if (!this.rbt_automaticCal.Checked)
                {
                    //当手动布置时，采用界面输入角度
                    CommonData.Instance.EntranceAngle = Angle.FromDegrees(CommonData.Instance.CommomTotal.LeftAngle);
                    CommonData.Instance.ExitAngle = Angle.FromDegrees(CommonData.Instance.CommomTotal.RightAngle);
                }

                CommonData.Instance.CommomTotal.LeftAngle = GetAngleByStep(CommonData.Instance.EntranceAngle.Degrees, 5);
                CommonData.Instance.CommomTotal.RightAngle = GetAngleByStep(CommonData.Instance.ExitAngle.Degrees, 5);

                CommonData.Instance.CommomTotal.LeftFillValue = CommonData.Instance.EntrancePointInfo.FillHeight;
                CommonData.Instance.CommomTotal.RightFillValue = CommonData.Instance.ExitPointInfo.FillHeight;
            }
            else
            {
                if (!this.rbt_automaticCal.Checked)
                {
                    //当手动布置时，采用界面输入角度
                    CommonData.Instance.CommomTotal.LeftAngle = GetAngleByStep(CommonData.Instance.ExitAngle.Degrees, 5);
                    CommonData.Instance.CommomTotal.RightAngle = GetAngleByStep(CommonData.Instance.EntranceAngle.Degrees, 5);
                }
                CommonData.Instance.CommomTotal.RightAngle = GetAngleByStep(CommonData.Instance.EntranceAngle.Degrees, 5);
                CommonData.Instance.CommomTotal.LeftAngle = GetAngleByStep(CommonData.Instance.ExitAngle.Degrees, 5);

                CommonData.Instance.CommomTotal.LeftFillValue = CommonData.Instance.ExitPointInfo.FillHeight;
                CommonData.Instance.CommomTotal.RightFillValue = CommonData.Instance.EntrancePointInfo.FillHeight;
            }
        }

        private void btn_Automatic_Click(object sender, EventArgs e)
        {
            //GetCulvertAlignmentInfo();
            CulvertLengthSubsection();

            #region 计算八字墙地基承载力
            //左洞口地基承载力   最高截面高度=内径+壁厚+一字墙超出高度+（基础入土深度h-翼墙基础厚度d）
            double maxLeftHeight =
                Convert.ToDouble(CommonData.Instance.CommomTotal.ClearSpanHeadroom.Split('×')[1].Trim()) +
                this.cmb_BasicsType.Text == "整体式" ? Convert.ToDouble(this.txt_UnitaryPiecePly.Text) * 0.01 : Convert.ToDouble(this.txt_SeparatingPiecePly.Text) * 0.01
                + Convert.ToDouble(this.txt_OverHeightIn.Text)
                + (CommonData.Instance.AliformWall.AliformWallLeft.BurialDepth - CommonData.Instance.AliformWall.AliformWallLeft.BaseThickness) * 0.01;

            this.txt_LeftAliformWallCarryingCapacity.Text = maxLeftHeight.ToString();
            //左洞口地基承载力   最高截面高度=内径+壁厚+一字墙超出高度+（基础入土深度h-翼墙基础厚度d）
            double maxRightHeight =
                Convert.ToDouble(CommonData.Instance.CommomTotal.ClearSpanHeadroom.Split('×')[1].Trim()) +
                this.cmb_BasicsType.Text == "整体式" ? Convert.ToDouble(this.txt_UnitaryPiecePly.Text) * 0.01 : Convert.ToDouble(this.txt_SeparatingPiecePly.Text) * 0.01
                + Convert.ToDouble(this.txt_OverHeightIn.Text)
                + (CommonData.Instance.AliformWall.AliformWallRight.BurialDepth - CommonData.Instance.AliformWall.AliformWallRight.BaseThickness) * 0.01;

            this.txt_RightAliformWallCarryingCapacity.Text = maxRightHeight.ToString();
            #endregion
        }

        private void CulvertLengthSubsection()
        {

            #region 根据进水口端墙超出高度计算对应涵长
            /**计算端墙超出高度对应水平长度
             * 注意：1.先判断进水口是否为内嵌
             *       2.需要判断那个点为进水口方向
             *       3.再判断进水口方向这个点是否在行车方向左侧，否则涵底坡度为相反数
            */
            if (this.rbt_EmbeddedIn.Checked)
            {
                double horizontalLength = 0;
                double baseSlope = CommonData.Instance.CommomTotal.Slope * 0.01;
                if (CommonData.Instance.EntrancePointInfo.IsEntrance) //是否为进水口
                {
                    if (CommonData.Instance.EntrancePointInfo.IsLeft)
                    {
                        if (baseSlope >= 0)
                        {
                            horizontalLength = GetHLengthByHeight(CommonData.Instance.EntrancePointInfo.Slope, baseSlope, CommonData.Instance.CommonCulvertLengthSet.OverHeightIn);
                        }
                        else
                        {
                            horizontalLength = GetHLengthByHeight_Negative(CommonData.Instance.EntrancePointInfo.Slope, Math.Abs(baseSlope), CommonData.Instance.CommonCulvertLengthSet.OverHeightIn); ;
                        }
                    }
                    else
                    {
                        if (baseSlope >= 0)
                        {
                            horizontalLength = GetHLengthByHeight_Negative(CommonData.Instance.EntrancePointInfo.Slope, Math.Abs(baseSlope), CommonData.Instance.CommonCulvertLengthSet.OverHeightIn);
                        }
                        else
                        {
                            horizontalLength = GetHLengthByHeight(CommonData.Instance.EntrancePointInfo.Slope, Math.Abs(baseSlope), CommonData.Instance.CommonCulvertLengthSet.OverHeightIn);
                        }
                    }
                }
                else
                {
                    if (CommonData.Instance.ExitPointInfo.IsLeft)
                    {
                        if (baseSlope >= 0)
                        {
                            horizontalLength = GetHLengthByHeight(CommonData.Instance.ExitPointInfo.Slope, baseSlope, CommonData.Instance.CommonCulvertLengthSet.OverHeightIn);
                        }
                        else
                        {
                            horizontalLength = GetHLengthByHeight_Negative(CommonData.Instance.ExitPointInfo.Slope, Math.Abs(baseSlope), CommonData.Instance.CommonCulvertLengthSet.OverHeightIn);
                        }
                    }
                    else
                    {
                        if (baseSlope >= 0)
                        {
                            horizontalLength = GetHLengthByHeight_Negative(CommonData.Instance.ExitPointInfo.Slope, Math.Abs(baseSlope), CommonData.Instance.CommonCulvertLengthSet.OverHeightIn);
                        }
                        else
                        {
                            horizontalLength = GetHLengthByHeight(CommonData.Instance.ExitPointInfo.Slope, Math.Abs(baseSlope), CommonData.Instance.CommonCulvertLengthSet.OverHeightIn);
                        }
                    }
                }
                CommonData.Instance.intoLength = horizontalLength;
            }
            else
            {
                CommonData.Instance.intoLength = 0;
            }
            #endregion
            //if (this.txt_width.Text == "") return;
            #region 涵长分段
            //左斜盖板长度
            double leftWdith;
            double rightWdith;
            if (CommonData.Instance.CommomTotal.LeftAngle != 90)
            {
                leftWdith = (CommonData.Instance.CoverPlateParameter.LeftInclinedPlate.ShortSideLength + CommonData.Instance.CoverPlateParameter.LeftInclinedPlate.LongSideLength) / 2;
            }
            else
            {
                leftWdith = CommonData.Instance.CoverPlateParameter.FrontPlate.Width == 0.99 ? 1 : CommonData.Instance.CoverPlateParameter.FrontPlate.Width;
            }
            if (CommonData.Instance.CommomTotal.RightAngle != 90)
            {
                rightWdith = (CommonData.Instance.CoverPlateParameter.RightInclinedPlate.ShortSideLength + CommonData.Instance.CoverPlateParameter.RightInclinedPlate.LongSideLength) / 2;
            }
            else
            {
                rightWdith = CommonData.Instance.CoverPlateParameter.FrontPlate.Width == 0.99 ? 1 : CommonData.Instance.CoverPlateParameter.FrontPlate.Width;
            }
            double outletWaterVal = 0; //出水口内嵌或外延值
            if (CommonData.Instance.CommomTotal.CoverPlateType == "预制")
            {
                var prefabrication = PrefabricateSlabCulvertSubsection.GetslabCulvertSubsectionData(
                    CommonData.Instance.VirtualCulvertLength,
                    leftWdith,
                    rightWdith,
                    CommonData.Instance.CommonCulvertLengthSet.MinDistance,
                    CommonData.Instance.CommonCulvertLengthSet.MaxDistance,
                    CommonData.Instance.intoLength, //进水口内嵌端墙超出高度对应水平值
                    this.rbt_InlineOut.Checked,
                    out outletWaterVal
                    );
                DgvSubsectionData.SetSubsectionDgv(prefabrication.lengthOfPanelSubsection, prefabrication.SectionSubsection, this.dgv_Slot);
                //真实涵长
                CommonData.Instance.CulvertLength = prefabrication.lengthOfPanelSubsection.Sum(); //CommonData.Instance.VirtualCulvertLength - outletWaterVal;
            }
            else if (this.cmb_CoverplateType.Text == "现浇")
            {
                var castInplace = CastInPlaceSlabCulvertSubsection.GetslabCulvertSubsectionData(
                    CommonData.Instance.VirtualCulvertLength,
                    leftWdith,
                    rightWdith,
                    CommonData.Instance.CommonCulvertLengthSet.MinDistance,
                    CommonData.Instance.CommonCulvertLengthSet.MaxDistance,
                    CommonData.Instance.intoLength,
                    this.rbt_InlineOut.Checked,
                    out outletWaterVal
                    );
                DgvSubsectionData.SetSubsectionDgv(castInplace.lengthOfPanelSubsection, castInplace.SectionSubsection, this.dgv_Slot);
                //真实涵长
                CommonData.Instance.CulvertLength = castInplace.lengthOfPanelSubsection.Sum(); // CommonData.Instance.VirtualCulvertLength - outletWaterVal; 
            }
            CommonData.Instance.outLength = outletWaterVal; //出水口内嵌端墙超出高度或外延对应水平值
            #endregion

            #region 换填长度
            Commands.mainForm.txt_ExchangeFillLength.Text = CommonData.Instance.CulvertLength.ToString();
            foreach (string k in this.replaceMent.Keys)
            {
                replaceMent[k].ExchangeFillLength = CommonData.Instance.CulvertLength;
            }
            #endregion

            #region 出水口界面参数设置
            if (rbt_InlineOut.Checked) //内嵌
            {
                #region 根据涵长计算出水口内嵌端墙超出高度
                /*
                 * 注意：1.先判断进水口是否为内嵌
                 *       2.需要判断那个点为进水口方向
                 *       3.再判断进水口方向这个点是否在行车方向左侧，否则涵底坡度为相反数
                */
                double outHeight = 0;
                double baseSlope = Convert.ToDouble(txt_CulvertBaseSlope.Text) * 0.01;
                if (CommonData.Instance.EntrancePointInfo.IsEntrance) //是否为进水口
                {
                    if (CommonData.Instance.EntrancePointInfo.IsLeft)
                    {
                        if (baseSlope >= 0)
                        {
                            outHeight = GetyHeightByHLength(CommonData.Instance.EntrancePointInfo.Slope, baseSlope, outletWaterVal);
                        }
                        else
                        {
                            outHeight = GetyHeightByHLength_Negative(CommonData.Instance.EntrancePointInfo.Slope, Math.Abs(baseSlope), outletWaterVal); ;
                        }
                    }
                    else
                    {
                        if (baseSlope >= 0)
                        {
                            outHeight = GetyHeightByHLength_Negative(CommonData.Instance.EntrancePointInfo.Slope, Math.Abs(baseSlope), outletWaterVal);
                        }
                        else
                        {
                            outHeight = GetyHeightByHLength(CommonData.Instance.EntrancePointInfo.Slope, Math.Abs(baseSlope), outletWaterVal);
                        }
                    }
                }
                else
                {
                    if (CommonData.Instance.ExitPointInfo.IsLeft)
                    {
                        if (baseSlope >= 0)
                        {
                            outHeight = GetyHeightByHLength(CommonData.Instance.ExitPointInfo.Slope, baseSlope, outletWaterVal);
                        }
                        else
                        {
                            outHeight = GetyHeightByHLength_Negative(CommonData.Instance.ExitPointInfo.Slope, Math.Abs(baseSlope), outletWaterVal);
                        }
                    }
                    else
                    {
                        if (baseSlope >= 0)
                        {
                            outHeight = GetyHeightByHLength_Negative(CommonData.Instance.ExitPointInfo.Slope, Math.Abs(baseSlope), outletWaterVal);
                        }
                        else
                        {
                            outHeight = GetyHeightByHLength(CommonData.Instance.ExitPointInfo.Slope, Math.Abs(baseSlope), outletWaterVal);
                        }
                    }
                }
                #endregion
                CommonData.Instance.CommonCulvertLengthSet.OverHeightOut = Math.Abs(Math.Round(outHeight, 4)); //分段
                this.txt_OverallEmbeddedOut.Text = Math.Abs(Math.Round(outHeight, 4)).ToString(); //主体
            }
            else
            {
                CommonData.Instance.CommonCulvertLengthSet.ExtensionOut = Math.Abs(Math.Round(outletWaterVal, 4)); //分段
                this.txt_OverallEmbeddedOut.Text = Math.Abs(Math.Round(outletWaterVal, 4)).ToString(); //总体
            }
            #endregion

            #region 放置点及放置矩阵
            if (CommonData.Instance.EntrancePointInfo.IsLeft)
            {
                //涵洞摆放矩阵
                CommonData.Instance.placePtDmatrix3d = GetDMatrix3dform2Pt(
                    new DPoint3d(CommonData.Instance.EntrancePointInfo.PointOnLayLine.X, CommonData.Instance.EntrancePointInfo.PointOnLayLine.Y, 0),
                    new DPoint3d(CommonData.Instance.ExitPointInfo.PointOnLayLine.X, CommonData.Instance.ExitPointInfo.PointOnLayLine.Y, 0));

                //涵洞放置点
                double staStation = CommonData.Instance.CulverIntersectingLine.LinearGeometry.ProjectPointOnPerpendicular(CommonData.Instance.EntrancePointInfo.PointOnLayLine).DistanceAlong;

                if (CommonData.Instance.EntrancePointInfo.IsEntrance) //是否进水口
                {
                    LinearPoint linearPoint = CommonData.Instance.linearEntity2DInPlan.BaseGeometry.GetPointAtDistanceOffset(staStation + CommonData.Instance.intoLength, 0);
                    CommonData.Instance.culvertPlacePoint3d = CommonData.Instance.linearEntity2DInPlan.ActiveLinearEntity3d.BaseGeometry.ProjectPointOnPerpendicular(linearPoint.Coordinates).Coordinates;
                }
                else
                {
                    if (this.rbt_ExtensionOut.Checked) //出水口外延
                    {
                        LinearPoint linearPoint = CommonData.Instance.linearEntity2DInPlan.BaseGeometry.GetPointAtDistanceOffset(staStation - CommonData.Instance.outLength, 0);
                        CommonData.Instance.culvertPlacePoint3d = CommonData.Instance.linearEntity2DInPlan.ActiveLinearEntity3d.BaseGeometry.ProjectPointOnPerpendicular(linearPoint.Coordinates).Coordinates;
                    }
                    else
                    {
                        LinearPoint linearPoint = CommonData.Instance.linearEntity2DInPlan.BaseGeometry.GetPointAtDistanceOffset(staStation + CommonData.Instance.outLength, 0);
                        CommonData.Instance.culvertPlacePoint3d = CommonData.Instance.linearEntity2DInPlan.ActiveLinearEntity3d.BaseGeometry.ProjectPointOnPerpendicular(linearPoint.Coordinates).Coordinates;
                    }
                }
            }
            else
            {
                //涵洞摆放矩阵
                CommonData.Instance.placePtDmatrix3d = GetDMatrix3dform2Pt(
                    new DPoint3d(CommonData.Instance.ExitPointInfo.PointOnLayLine.X, CommonData.Instance.ExitPointInfo.PointOnLayLine.Y, 0),
                    new DPoint3d(CommonData.Instance.EntrancePointInfo.PointOnLayLine.X, CommonData.Instance.EntrancePointInfo.PointOnLayLine.Y, 0));
                //涵洞放置点
                double staStation = CommonData.Instance.CulverIntersectingLine.LinearGeometry.ProjectPointOnPerpendicular(CommonData.Instance.ExitPointInfo.PointOnLayLine).DistanceAlong;
                if (CommonData.Instance.ExitPointInfo.IsEntrance) //是否进水口
                {
                    LinearPoint linearPoint = CommonData.Instance.linearEntity2DInPlan.BaseGeometry.GetPointAtDistanceOffset(staStation + CommonData.Instance.intoLength, 0);
                    CommonData.Instance.culvertPlacePoint3d = CommonData.Instance.linearEntity2DInPlan.ActiveLinearEntity3d.BaseGeometry.ProjectPointOnPerpendicular(linearPoint.Coordinates).Coordinates;
                }
                else
                {
                    if (this.rbt_ExtensionOut.Checked) //出水口外延
                    {
                        LinearPoint linearPoint = CommonData.Instance.linearEntity2DInPlan.BaseGeometry.GetPointAtDistanceOffset(staStation - CommonData.Instance.outLength, 0);
                        CommonData.Instance.culvertPlacePoint3d = CommonData.Instance.linearEntity2DInPlan.ActiveLinearEntity3d.BaseGeometry.ProjectPointOnPerpendicular(linearPoint.Coordinates).Coordinates;
                    }
                    else
                    {
                        LinearPoint linearPoint = CommonData.Instance.linearEntity2DInPlan.BaseGeometry.GetPointAtDistanceOffset(staStation + CommonData.Instance.outLength, 0);
                        CommonData.Instance.culvertPlacePoint3d = CommonData.Instance.linearEntity2DInPlan.ActiveLinearEntity3d.BaseGeometry.ProjectPointOnPerpendicular(linearPoint.Coordinates).Coordinates;
                    }
                }
            }
            #endregion
        }

        //获得桩号
        public static double getStaionNumber(Alignment al, DPoint3d pt)
        {
            //LinearPoint.DistanceAlong 为路线上的距离
            LinearPoint LePt = al.LinearGeometry.ProjectPointOnPerpendicular(pt);
            //获取路线上的桩号系统
            Bentley.CifNET.GeometryModel.SDK.Stationing station = al.Stationing;
            //通过路线的桩号系统获取对应距离处的桩号
            Bentley.CifNET.GeometryModel.SDK.StationRegion stationReg = station.GetStationRegionFromDistanceAlong(LePt.DistanceAlong);
            //读取station
            double stationNumber = stationReg.Station;
            return stationNumber;
        }


        /// <summary>
        /// 根据端墙超出高度计算对应涵长（进水口到出水口坡度为正值）
        /// </summary>
        /// <param name="BPSlope">边坡坡率</param>
        /// <param name="culvertSlope">涵底坡度（正值）</param>
        /// <param name="overHeightIn">端墙超出高度</param>
        /// <returns></returns>
        public static double GetHLengthByHeight(double BPSlope, double culvertSlope, double overHeightIn)
        {
            double A = Math.Atan(BPSlope);
            double B = Math.Atan(culvertSlope);
            double C = A - B;
            double D = Math.PI * 0.5 - A;
            double TA = overHeightIn * Math.Sin(D);
            double TC = TA / Math.Sin(C);
            return TC * Math.Cos(B);
        }

        /// <summary>
        /// 根据水平长度计算端墙超出高度（进水口到出水口坡度为正值）
        /// </summary>
        /// <param name="BPSlope">边坡坡率</param>
        /// <param name="culvertSlope">涵底坡度（正值）</param>
        /// <param name="overLenth">端墙超出高度</param>
        /// <returns></returns>
        public static double GetyHeightByHLength(double BPSlope, double culvertSlope, double overLenth)
        {
            double A = Math.Atan(BPSlope);
            double B = Math.Atan(culvertSlope);
            double C = A - B;
            double D = Math.PI * 0.5 - A;
            double TC = overLenth / Math.Cos(B);
            double TA = TC * Math.Sin(C);
            return TA / Math.Sin(A);
        }

        /// <summary>
        /// 根据端墙超出高度计算对应涵长（进水口到出水口坡度为负值）
        /// </summary>
        /// <param name="BPSlope">边坡坡率</param>
        /// <param name="culvertSlope">涵底坡度（正值）</param>
        /// <param name="overHeightIn">端墙超出高度</param>
        /// <returns></returns>
        public static double GetHLengthByHeight_Negative(double BPSlope, double culvertSlope, double overHeightIn)
        {
            double XX = overHeightIn / (culvertSlope + BPSlope);
            return XX;
        }
        /// <summary>
        /// 根据水平长度计算端墙超出高度（进水口到出水口坡度为负值）
        /// </summary>
        /// <param name="BPSlope">边坡坡率</param>
        /// <param name="culvertSlope">涵底坡度（正值）</param>
        /// <param name="overLenth">水平长度</param>
        /// <returns></returns>
        public static double GetyHeightByHLength_Negative(double BPSlope, double culvertSlope, double overLenth)
        {
            double ZZ = overLenth * (culvertSlope + BPSlope);
            return ZZ;
        }


        private List<string> GetDgnFileModels(string dgnFileName)
        {
            string dgnFilePath = /*ConfigurationManager.GetVariable("Checc_CulvertCustomPath") + @"Standards\Cell\盖板涵\" +*/ dgnFileName;
            DgnDocument document = DgnDocument.CreateForLocalFile(dgnFilePath);
            DgnFileOwner owner = DgnFile.Create(document, DgnFileOpenMode.ReadOnly);
            DgnFile cellFile = owner.DgnFile;
            cellFile.LoadDgnFile(out StatusInt fileLoadstatus);
            if (fileLoadstatus == StatusInt.Error)
            {
                return null;
            }
            var models = cellFile.GetModelIndexCollection();
            return models.ToList().Select(s => s.Name).Where(w => w.ToString() != "Default").ToList();
        }

        /// <summary>
        /// 给定下拉框控件最大宽度
        /// </summary>
        /// <param name="cmb"></param>
        private void CmbDropDownWidth(ComboBox cmb)
        {
            // 测量出最大的字符大小
            int maxSize = 0;
            System.Drawing.Graphics g = CreateGraphics();
            for (int i = 0; i < cmb.Items.Count; i++)
            {
                cmb.SelectedIndex = i;
                SizeF size = g.MeasureString(cmb.Text, cmb.Font);
                if (maxSize < (int)size.Width)
                {
                    maxSize = (int)size.Width;
                }
            }
            cmb.DropDownWidth = cmb.Width;
            if (cmb.DropDownWidth < maxSize)
            {
                cmb.DropDownWidth = maxSize;
                //comboBox1.Width = maxSize;
            }
            if (cmb.Items.Count > 0)
            {
                cmb.SelectedIndex = 0;
            }
        }

        private void SpiltTh(string depthOfFillTh, out double start, out double end)
        {
            //拆解填土高度
            string newDepthOfFillTh = "";
            for (int i = 1; i < depthOfFillTh.Length - 1; i++)
            {
                newDepthOfFillTh += depthOfFillTh[i];
            }
            string[] ttgd = newDepthOfFillTh.Split(',');
            if (ttgd.Length < 2)
                ttgd = newDepthOfFillTh.Split('，');
            if (depthOfFillTh[0].ToString() == "(")
                start = Math.Round(Convert.ToDouble(ttgd[0]));// Convert.ToDouble(ttgd[0])+ 0.0001;
            else
                start = Math.Round(Convert.ToDouble(ttgd[0]));
            if (depthOfFillTh[depthOfFillTh.Length - 1].ToString() == ")")
                end = Math.Round(Convert.ToDouble(ttgd[1])); //Convert.ToDouble(ttgd[1]) - 0.0001;
            else
                end = Math.Round(Convert.ToDouble(ttgd[1]));
        }
        public void LoadForm()
        {
            Assemble_Load(null, null);
        }
        bool tempSwitch = false;
        /// <summary>
        /// 是否更改填土或者涵底高程
        /// </summary>
        bool isAlter = false;
        private void Assemble_Load(object sender, EventArgs e)
        {
            cmb_IsAisle.SelectedIndex = 0;

            #region 涵长分段dgv设置
            this.dgv_Slot.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
            for (int i = 0; i < this.dgv_Slot.Columns.Count; i++)
            {
                this.dgv_Slot.Columns[i].SortMode = DataGridViewColumnSortMode.NotSortable;
            }
            this.dgv_Slot.Columns[0].FillWeight = 30;      //第一列的相对宽度为20%
            this.dgv_Slot.Columns[1].FillWeight = 40;      //第二列的相对宽度为50%
            this.dgv_Slot.Columns[2].FillWeight = 30;      //第三列的相对宽度为30%

            //this.dgv_Slot[0,2].ReadOnly = true;
            #endregion
            #region 界面赋初始值
            HttpRequestData httpRequestData = HttpRequestData.CreateHttpRequestData();
            this.cmb_StandardDrawing.DataSource = httpRequestData.SelectAssembleLeftEightFigureWall("").Select(s => s.generalDiagram).Distinct().ToList();
            #region 总体设计

            this.txt_OverallEmbeddedIn.Enabled = false;

            //填土默认值
            CommonData.Instance.CommomTotal.FillValue = 0.5;

            this.cmb_LeftHeadWall.DataSource = settingAndNo;
            this.cmb_LeftCapStone.DataSource = settingAndNo;
            this.cmb_RightHeadWall.DataSource = settingAndNo;
            this.cmb_RightCapStone.DataSource = settingAndNo;
            #endregion

            GetDBCulvertData();
            #endregion

            WellDepth();

            #region 通道

            dgv_MatFormation.Rows.Add();
            dgv_MatFormation[0, 0].Value = 1;
            dgv_MatFormation[1, 0].Value = 50;
            dgv_MatFormation[3, 0].Value = 0.02;

            this.cmb_IsSet.SelectedIndex = 0;
            this.cmb_DrainLocation.SelectedIndex = 0;
            this.cmb_SaidSize.SelectedIndex = 0;
            this.cmb_Materials.SelectedIndex = 0;
            this.cmb_CoverMaterials.SelectedIndex = 0;
            this.cmb_ResetBoard.SelectedIndex = 0;
            CommonData.Instance.CulvertAisleEntity.IsGutterway = "是";
            CommonData.Instance.CulvertAisleEntity.GutterwayLocation = "左侧";
            CommonData.Instance.CulvertAisleEntity.TwoFlanksSize = "一致";
            CommonData.Instance.CulvertAisleEntity.StopDogMaterials = "C20";
            CommonData.Instance.CulvertAisleEntity.CoverPlateMaterials = "C20";
            CommonData.Instance.CulvertAisleEntity.ShelveMaterials = "C20";
            CommonData.Instance.CulvertAisleEntity.StopDogHigh_L = 50;
            CommonData.Instance.CulvertAisleEntity.StopDogThickness_L = 50;
            CommonData.Instance.CulvertAisleEntity.BracketWidth_L = 10;
            CommonData.Instance.CulvertAisleEntity.GutterwayWidth_L = 50;
            CommonData.Instance.CulvertAisleEntity.CoverPlateThickness_L1 = 20;
            CommonData.Instance.CulvertAisleEntity.ShelveWidth_L = 30;
            CommonData.Instance.CulvertAisleEntity.StopDogSlope_L = 0;
            CommonData.Instance.CulvertAisleEntity.StopDogHigh_R = 50;
            CommonData.Instance.CulvertAisleEntity.StopDogThickness_R = 50;
            CommonData.Instance.CulvertAisleEntity.BracketWidth_R = 10;
            CommonData.Instance.CulvertAisleEntity.GutterwayWidth_R = 50;
            CommonData.Instance.CulvertAisleEntity.CoverPlateThickness_R1 = 20;
            CommonData.Instance.CulvertAisleEntity.ShelveWidth_R = 30;
            CommonData.Instance.CulvertAisleEntity.StopDogSlope_R = 0;

            #endregion

            tempSwitch = true;
        }

        private void GetDBCulvertData()
        {
            tempSwitch = false;
            HttpRequestData httpRequestData = HttpRequestData.CreateHttpRequestData();
            #region 涵长分段
            List<SettlementJointParameter> settlementJointParameters = httpRequestData.GetAssembleSettlementJointWraps();
            if (settlementJointParameters == null)
            {
                return;
            }

            CommonData.Instance.CommonCulvertLengthSet.MinDistance = settlementJointParameters[0].minimumSpacing;
            CommonData.Instance.CommonCulvertLengthSet.MaxDistance = settlementJointParameters[0].maximumSpacing;
            CommonData.Instance.CommonCulvertLengthSet.SedimentationWidth = settlementJointParameters[0].pipeJointSettlementSeamWidth;
            CommonData.Instance.CommonCulvertLengthSet.BaseWidth = settlementJointParameters[0].foundationSettlementSeamWidth;
            #endregion

            #region 洞身基础
            //整体式  
            List<IntegralStructureSizeParameter> integralStructureSizeParameters = httpRequestData.SelectAssembleIntegralStructureDimensionParameter();
            if (integralStructureSizeParameters == null)
            {
                return;
            }
            //总体净跨净高
            List<string> clearSpanAndHeight = integralStructureSizeParameters.Select(s => s.clearSpan).Distinct().ToList();
            this.cmb_ClearSpanAndHeight.DataSource = clearSpanAndHeight;
            CommonData.Instance.CommomTotal.ClearSpanHeadroom = clearSpanAndHeight[0];
            List<ProtectiveThickness> protectiveThicknesses = httpRequestData.SelectAssembleProtectiveThickness();

            for (int i = 0; i < integralStructureSizeParameters.Count; i++)
            {
                if (integralStructureSizeParameters[i].name.Contains("广东版") &&
                    integralStructureSizeParameters[i].clearSpan == cmb_ClearSpanAndHeight.Text &&
                    integralStructureSizeParameters[i].foundationType.Contains(cmb_BasicsType.Text)
                    )
                {
                    SpiltTh(integralStructureSizeParameters[i].fillHeight, out double min, out double max);
                    if (Convert.ToDouble(this.txt_Fill.Text) >= min && Convert.ToDouble(this.txt_Fill.Text) <= max)
                    {
                        this.txt_UnitaryPiecePly.Text = integralStructureSizeParameters[i].platformBodyBlockH1.ToString();
                        this.txt_UnitaryBasics.Text = integralStructureSizeParameters[i].baseFlapsideLengthC1.ToString();
                        this.txt_UnitaryStandPly.Text = integralStructureSizeParameters[i].bodyThicknessC2.ToString();
                        this.txt_UnitaryStandTopWidth.Text = integralStructureSizeParameters[i].platformWidthC4.ToString();
                        this.txt_UnitaryBottomChamfer.Text = integralStructureSizeParameters[i].bottomChamferC7.ToString();
                        this.txt_UnitaryBasicsPly.Text = integralStructureSizeParameters[i].baseThicknessHd.ToString();
                        this.txt_UnitaryBearing.Text = integralStructureSizeParameters[i].allowableBearingCapacityFoundation.ToString();
                        this.txt_UnitaryCategory.DataSource = httpRequestData.SelectAssembleProtectiveThickness().Select(s => s.environmentalCategory).ToList();

                        //this.cmb_UnitaryProtectiveLayer.DataSource = httpRequestData.SelectAssembleProtectiveThickness().Select(s => s.recommended).ToList();

                        double minValue = protectiveThicknesses[0].minimumThickness;
                        double maxValue = protectiveThicknesses[0].maximumThickness;
                        double gradient = protectiveThicknesses[0].gradient;
                        for (int m = 0; m < (maxValue - minValue) / gradient + 1; m++)
                        {
                            double temp = minValue;
                            temp += m * gradient;
                            temp = Math.Round(temp, 3);
                            this.cmb_UnitaryProtectiveLayer.Items.Add(temp.ToString());
                        }
                        this.cmb_UnitaryProtectiveLayer.Text = protectiveThicknesses[0].recommended.ToString();
                        break;
                    }
                }
            }
            //分离式
            List<SeparateStructureSizeParameter> separateStructureSizeParameters = httpRequestData.SelectAssembleSeparateStructureParameters();
            if (separateStructureSizeParameters == null)
            {
                return;
            }
            for (int i = 0; i < separateStructureSizeParameters.Count; i++)
            {
                if (separateStructureSizeParameters[i].name.Contains("广东版") &&
                    separateStructureSizeParameters[i].clearSpan == cmb_ClearSpanAndHeight.Text //&&
                                                                                                //separateStructureSizeParameters[i].foundationType.Contains(cmb_BasicsType.Text)
                    )
                {
                    SpiltTh(separateStructureSizeParameters[i].fillHeight, out double min, out double max);
                    if (Convert.ToDouble(this.txt_Fill.Text) >= min && Convert.ToDouble(this.txt_Fill.Text) <= max)
                    {
                        this.txt_SeparatingPiecePly.Text = separateStructureSizeParameters[i].platformBodyBlockH1.ToString();
                        this.txt_SeparatingBasics.Text = separateStructureSizeParameters[i].baseFlapsideLengthC1.ToString();
                        this.txt_SeparatingStandPly.Text = separateStructureSizeParameters[i].bodyThicknessC2.ToString();
                        this.txt_SeparatingBasicWidth.Text = separateStructureSizeParameters[i].splitBaseWidthC3.ToString();
                        this.txt_SeparatingStandTopWidth.Text = separateStructureSizeParameters[i].platformBodyWidthC4.ToString();
                        this.txt_SeparatingBasicsPly.Text = separateStructureSizeParameters[i].separatedBaseThicknessHd.ToString();
                        this.txt_SeparatingBearing.Text = separateStructureSizeParameters[i].allowableBearingCapacityFoundation.ToString();
                        break;
                    }
                }
            }
            #endregion
            #region 帽石
            //左帽石
            List<CapStone> leftCapStones = httpRequestData.SelectAssembleLeftCapStone(CommonData.Instance.CommomTotal.GeneralDiagram);
            if (leftCapStones == null)
            {
                return;
            }
            if (leftCapStones.Count > 0)
            {
                CommonData.Instance.CapStone.CapStoneLeft.Width = leftCapStones[0].capStoneWidth;
                CommonData.Instance.CapStone.CapStoneLeft.Chamfering = leftCapStones[0].capStoneChamfering;
                CommonData.Instance.CapStone.CapStoneLeft.Height = leftCapStones[0].capStoneHeight;
                CommonData.Instance.CapStone.CapStoneLeft.OutQuantity = leftCapStones[0].capStoneOverhang;
                CommonData.Instance.CapStone.CapStoneLeft.Material = leftCapStones[0].capStoneMaterial;
            }

            //右帽石
            List<CapStone> rightCapStones = httpRequestData.SelectAssembleRightCapStone(CommonData.Instance.CommomTotal.GeneralDiagram);
            if (rightCapStones == null)
            {
                return;
            }
            if (rightCapStones.Count > 0)
            {
                CommonData.Instance.CapStone.CapStoneRight.Width = rightCapStones[0].capStoneWidth;
                CommonData.Instance.CapStone.CapStoneRight.Chamfering = rightCapStones[0].capStoneChamfering;
                CommonData.Instance.CapStone.CapStoneRight.Height = rightCapStones[0].capStoneHeight;
                CommonData.Instance.CapStone.CapStoneRight.OutQuantity = rightCapStones[0].capStoneOverhang;
                CommonData.Instance.CapStone.CapStoneRight.Material = rightCapStones[0].capStoneMaterial;
            }
            #endregion
            #region 端墙
            //墙背坡度、埋深
            List<EndWallSearchEntry> endWallBackSlopes = httpRequestData.SelectAssembleEndWallSearch(CommonData.Instance.CommomTotal.GeneralDiagram);
            if (endWallBackSlopes == null)
            {
                return;
            }
            List<double> slopWallBackListss = endWallBackSlopes.Select(s => s.slopeWallBack).ToList();
            List<double> slopWallBackLists = endWallBackSlopes.Select(s => s.slopeWallBack).Distinct().ToList();
            if (endWallBackSlopes.Count > 0)
            {
                this.cmb_LeftEndWallBackSlope.DataSource = new List<double>(slopWallBackLists);
                this.cmb_RightEndWallBackSlope.DataSource = new List<double>(slopWallBackLists);
                CommonData.Instance.EndWall.EndWallLeft.Slope = slopWallBackLists[0];
                CommonData.Instance.EndWall.EndWallRight.Slope = slopWallBackLists[0];

                //端墙基础埋深
                //List<double> endWallBaseBurialDepthLists = endWallBackSlopes.Select(s => s.buriedDepthFoundation).ToList();
                List<double> endWallBaseBurialDepthLists = endWallBackSlopes.Where(s => s.slopeWallBack == slopWallBackLists[0]).ToList().Select(z => z.buriedDepthFoundation).ToList();
                this.cmb_LeftEndWallBaseBurialDepth.DataSource = endWallBaseBurialDepthLists;
                this.cmb_RightEndWallBaseBurialDepth.DataSource = endWallBaseBurialDepthLists;
                CommonData.Instance.EndWall.EndWallLeft.BaseBurialDepth = endWallBaseBurialDepthLists[0];
                CommonData.Instance.EndWall.EndWallRight.BaseBurialDepth = endWallBaseBurialDepthLists[0];
            }

            //左侧端墙
            List<EndWall> leftEndWalls = httpRequestData.SelectAssembleLeftEndWalls(CommonData.Instance.CommomTotal.GeneralDiagram);
            if (leftEndWalls == null)
            {
                return;
            }
            if (leftEndWalls.Count > 0)
            {
                /*涵顶以上墙高=端墙超出高度*/
                CommonData.Instance.EndWall.EndWallLeft.Height = 0;
                CommonData.Instance.EndWall.EndWallLeft.BaseNumberOfPlies = leftEndWalls[0].foundationLayers;
                CommonData.Instance.EndWall.EndWallLeft.BaseHeight = leftEndWalls[0].foundationHeight;
                CommonData.Instance.EndWall.EndWallLeft.Width = leftEndWalls[0].topWidth;
                CommonData.Instance.EndWall.EndWallLeft.Overhang = leftEndWalls[0].wallHanging;
                CommonData.Instance.EndWall.EndWallLeft.EdgeIn = leftEndWalls[0].innerBaseFlaperside;
                CommonData.Instance.EndWall.EndWallLeft.EdgeOut = leftEndWalls[0].outsideBaseFlaperside;
                CommonData.Instance.EndWall.EndWallLeft.Material = leftEndWalls[0].lineWallMaterial;
            }


            //右侧端墙
            List<EndWall> rightEndWalls = httpRequestData.SelectAssembleRightEndWalls(CommonData.Instance.CommomTotal.GeneralDiagram);
            if (rightEndWalls == null)
            {
                return;
            }
            if (rightEndWalls.Count > 0)
            {
                CommonData.Instance.EndWall.EndWallRight.Height = 0;
                CommonData.Instance.EndWall.EndWallRight.BaseNumberOfPlies = rightEndWalls[0].foundationLayers;
                CommonData.Instance.EndWall.EndWallRight.BaseHeight = rightEndWalls[0].foundationHeight;
                CommonData.Instance.EndWall.EndWallRight.Width = rightEndWalls[0].topWidth;
                CommonData.Instance.EndWall.EndWallRight.Overhang = rightEndWalls[0].wallHanging;
                CommonData.Instance.EndWall.EndWallRight.EdgeIn = rightEndWalls[0].innerBaseFlaperside;
                CommonData.Instance.EndWall.EndWallRight.EdgeOut = rightEndWalls[0].outsideBaseFlaperside;
                CommonData.Instance.EndWall.EndWallRight.Material = rightEndWalls[0].lineWallMaterial;
            }
            #endregion
            #region 八字墙
            //基础埋深
            List<AliformBaseBurialDepth> aliformBaseBurialDepths = httpRequestData.SelectWallFoundationBuriedDepth(CommonData.Instance.CommomTotal.GeneralDiagram);
            if (aliformBaseBurialDepths == null)
            {
                return;
            }
            if (aliformBaseBurialDepths.Count > 0)
            {
                List<double> aliformBaseBurialDepthLists = aliformBaseBurialDepths.Select(s => s.depthFoundation).ToList();
                this.cmb_LeftAliformWallBurialDepth.DataSource = new List<double>(aliformBaseBurialDepthLists);
                this.cmb_RightAliformWallBurialDepth.DataSource = new List<double>(aliformBaseBurialDepthLists);
                //总体中基础埋深数据绑定
                this.cmb_LeftBasicsDepth.DataSource = new List<double>(aliformBaseBurialDepthLists);
                this.cmb_RightBasicsDepth.DataSource = new List<double>(aliformBaseBurialDepthLists);
                CommonData.Instance.AliformWall.AliformWallLeft.BurialDepth = Convert.ToDouble(this.cmb_LeftBasicsDepth.Text);
                CommonData.Instance.AliformWall.AliformWallRight.BurialDepth = Convert.ToDouble(this.cmb_RightBasicsDepth.Text);
            }


            //左洞口
            List<Aliform> leftAliforms = httpRequestData.SelectAssembleLeftEightFigureWall(CommonData.Instance.CommomTotal.GeneralDiagram);
            if (leftAliforms == null)
            {
                return;
            }
            if (leftAliforms.Count > 0)
            {
                List<double> leftAliformLists = leftAliforms.Select(s => s.innerSideBase).ToList();
                this.cmb_LeftAliformWallInsideEdge.DataSource = new List<double>(leftAliformLists);
                this.cmb_LeftInsideEdge.DataSource = new List<double>(leftAliformLists);//总体设计内的内侧襟边

                CommonData.Instance.AliformWall.AliformWallLeft.InsideEdge = Convert.ToDouble(this.cmb_LeftInsideEdge.Text);
                CommonData.Instance.AliformWall.AliformWallLeft.OutSideEdge = leftAliforms[0].baseOutsideFlaperside;
                CommonData.Instance.AliformWall.AliformWallLeft.VeticalWidth = leftAliforms[0].topWingWallVerticallyWide;
                CommonData.Instance.AliformWall.AliformWallLeft.MinCrossProfileHeight = leftAliforms[0].minimumSectionHeightSlabWall;
                CommonData.Instance.AliformWall.AliformWallLeft.BaseThickness = leftAliforms[0].foundationThicknessWingWall;
                CommonData.Instance.AliformWall.AliformWallLeft.CutoffWallHeight = leftAliforms[0].highCutOffWall;
                CommonData.Instance.AliformWall.AliformWallLeft.PaveThickness = leftAliforms[0].thicknessPavingOpening;
                CommonData.Instance.AliformWall.AliformWallLeft.VerticalBackSlope = leftAliforms[0].wingWallSlopesVertically;
                CommonData.Instance.AliformWall.AliformWallLeft.CutoffWallThickness = leftAliforms[0].cutOffWallThick;
            }

            //左洞口地基承载力   最高截面高度=内径+壁厚+一字墙超出高度+（基础入土深度h-翼墙基础厚度d）
            double maxLeftHeight =
                Convert.ToDouble(CommonData.Instance.CommomTotal.ClearSpanHeadroom.Split('×')[1].Trim()) +
                this.cmb_BasicsType.Text == "整体式" ? Convert.ToDouble(this.txt_UnitaryPiecePly.Text) * 0.01 : Convert.ToDouble(this.txt_SeparatingPiecePly.Text) * 0.01
                + Convert.ToDouble(this.txt_OverHeightIn.Text)
                + (CommonData.Instance.AliformWall.AliformWallLeft.BurialDepth - CommonData.Instance.AliformWall.AliformWallLeft.BaseThickness) * 0.01;

            List<AliformBearingCapacity> leftAliformBearingCapacities = httpRequestData.SelectAssembleBearingCapacity(CommonData.Instance.CommomTotal.GeneralDiagram);
            if (leftAliformBearingCapacities == null)
            {
                return;
            }
            foreach (AliformBearingCapacity aliformBearingCapacity in leftAliformBearingCapacities)
            {
                string[] strArr = aliformBearingCapacity.highestSectionHeightEight.Split('，');
                double tempDouble1 = Convert.ToDouble(strArr[0]);
                double tempDouble2 = Convert.ToDouble(strArr[1]);
                if (maxLeftHeight > tempDouble1 && maxLeftHeight <= tempDouble2)
                {
                    CommonData.Instance.AliformWall.AliformWallLeft.CarryingCapacity = aliformBearingCapacity.bearingCapacity;
                    break;
                }
            }
            //右洞口
            List<Aliform> rightAliforms = httpRequestData.SelectAssembleRightEightFigureWall(CommonData.Instance.CommomTotal.GeneralDiagram);
            if (rightAliforms == null)
            {
                return;
            }
            if (rightAliforms.Count > 0)
            {
                List<double> rightAliformLists = rightAliforms.Select(s => s.innerSideBase).ToList();
                this.cmb_RightAliformWallInsideEdge.DataSource = new List<double>(rightAliformLists);
                this.cmb_RightInsideEdge.DataSource = new List<double>(rightAliformLists);//总体设计内的内侧襟边
                CommonData.Instance.AliformWall.AliformWallRight.OutSideEdge = rightAliforms[0].baseOutsideFlaperside;
                CommonData.Instance.AliformWall.AliformWallRight.VeticalWidth = rightAliforms[0].topWingWallVerticallyWide;
                CommonData.Instance.AliformWall.AliformWallRight.MinCrossProfileHeight = rightAliforms[0].minimumSectionHeightSlabWall;
                CommonData.Instance.AliformWall.AliformWallRight.BaseThickness = rightAliforms[0].foundationThicknessWingWall;
                CommonData.Instance.AliformWall.AliformWallRight.CutoffWallHeight = rightAliforms[0].highCutOffWall;
                CommonData.Instance.AliformWall.AliformWallRight.PaveThickness = rightAliforms[0].thicknessPavingOpening;
                CommonData.Instance.AliformWall.AliformWallRight.VerticalBackSlope = rightAliforms[0].wingWallSlopesVertically;
                CommonData.Instance.AliformWall.AliformWallRight.CutoffWallThickness = rightAliforms[0].cutOffWallThick;
            }
            //右洞口地基承载力   最高截面高度=内径+壁厚+一字墙超出高度+（基础入土深度h-翼墙基础厚度d）
            double maxRightHeight =
                Convert.ToDouble(CommonData.Instance.CommomTotal.ClearSpanHeadroom.Split('×')[1].Trim()) +
                this.cmb_BasicsType.Text == "整体式" ? Convert.ToDouble(this.txt_UnitaryPiecePly.Text) * 0.01 : Convert.ToDouble(this.txt_SeparatingPiecePly.Text) * 0.01
                + Convert.ToDouble(this.txt_OverHeightIn.Text)
                + (CommonData.Instance.AliformWall.AliformWallLeft.BurialDepth - CommonData.Instance.AliformWall.AliformWallLeft.BaseThickness) * 0.01;

            List<AliformBearingCapacity> rightAliformBearingCapacities = httpRequestData.SelectAssembleBearingCapacity(CommonData.Instance.CommomTotal.GeneralDiagram);
            if (rightAliformBearingCapacities == null)
            {
                return;
            }
            foreach (AliformBearingCapacity aliformBearingCapacity in rightAliformBearingCapacities)
            {
                string[] strArr = aliformBearingCapacity.highestSectionHeightEight.Split('，');
                double tempDouble1 = Convert.ToDouble(strArr[0]);
                double tempDouble2 = Convert.ToDouble(strArr[1]);
                if (maxRightHeight > tempDouble1 && maxRightHeight <= tempDouble2)
                {
                    CommonData.Instance.AliformWall.AliformWallRight.CarryingCapacity = aliformBearingCapacity.bearingCapacity;
                    break;
                }
            }

            //左洞口八字墙距洞口内侧襟边
            List<AliformEntranceCaveInEdge> aliformEntranceCaveInEdges = httpRequestData.SelectAssembleShapedWallHole();
            List<double> entranceCaveEdge = aliformEntranceCaveInEdges.Where(w => w.generalDiagram == CommonData.Instance.CommomTotal.GeneralDiagram).Select(s => s.innerSide).ToList();
            this.cmb_LeftAliformWallInEdge.DataSource = new List<double>(entranceCaveEdge);
            this.cmb_RightAliformWallInEdge.DataSource = new List<double>(entranceCaveEdge);
            CommonData.Instance.AliformWall.AliformWallLeft.CulvertInEdge = Convert.ToDouble(this.cmb_LeftAliformWallInEdge.Text);
            CommonData.Instance.AliformWall.AliformWallRight.CulvertInEdge = Convert.ToDouble(this.cmb_RightAliformWallInEdge.Text);
            #endregion
            #region 锥坡
            //左侧锥坡断面坡比
            List<ConicalSlopeRatio> leftConicalSlopeRatios = httpRequestData.SelectAssembleLeftConeSlopeRatio(CommonData.Instance.CommomTotal.GeneralDiagram);
            if (leftConicalSlopeRatios == null)
            {
                return;
            }
            if (leftConicalSlopeRatios.Count > 0)
            {
                List<double> leftConicalSlopeRatioLists = leftConicalSlopeRatios.Select(s => s.popby).ToList();
                this.cmb_OverallSlopeRatioLeft.DataSource = new List<double>(leftConicalSlopeRatioLists);
                this.cmb_LeftSectionSlopeRatio.DataSource = new List<double>(leftConicalSlopeRatioLists);
                CommonData.Instance.ConicalSlope.ConicalSlopeLeft.SlopeRatio = leftConicalSlopeRatioLists[0];
            }


            //右侧锥坡断面坡比
            List<ConicalSlopeRatio> rightConicalSlopeRatios = httpRequestData.SelectAssembleRightConeSlopeRatio(CommonData.Instance.CommomTotal.GeneralDiagram);
            if (rightConicalSlopeRatios == null)
            {
                return;
            }
            if (rightConicalSlopeRatios.Count > 0)
            {
                List<double> rightConicalSlopeRatioLists = rightConicalSlopeRatios.Select(s => s.popby).ToList();
                this.cmb_OverallSlopeRatioRight.DataSource = new List<double>(rightConicalSlopeRatioLists);
                this.cmb_RightSectionSlopeRatio.DataSource = new List<double>(rightConicalSlopeRatioLists);
                CommonData.Instance.ConicalSlope.ConicalSlopeRight.SlopeRatio = rightConicalSlopeRatioLists[0];
            }


            //左侧锥坡基础深度
            List<ConicalSlopeBaseDepth> leftConicalSlopeBaseDepths = httpRequestData.SelectAssemblebaseDepthLeftConicalSlope(CommonData.Instance.CommomTotal.GeneralDiagram);
            if (leftConicalSlopeBaseDepths == null)
            {
                return;
            }
            if (leftConicalSlopeBaseDepths.Count > 0)
            {
                List<double> leftConicalSlopeBaseDepthLists = leftConicalSlopeBaseDepths.Select(s => s.depthFoundation).ToList();
                this.cmb_OverallBaseDepthLeft.DataSource = new List<double>(leftConicalSlopeBaseDepthLists);
                this.cmb_LeftBaseDepth.DataSource = new List<double>(leftConicalSlopeBaseDepthLists);
                CommonData.Instance.ConicalSlope.ConicalSlopeLeft.BaseDepth = leftConicalSlopeBaseDepthLists[0];
            }
            //右侧锥坡基础深度
            List<ConicalSlopeBaseDepth> rightConicalSlopeBaseDepths = httpRequestData.SelectAssemblebaseDepthRightConicalSlope(CommonData.Instance.CommomTotal.GeneralDiagram);
            if (rightConicalSlopeBaseDepths == null)
            {
                return;
            }
            if (rightConicalSlopeBaseDepths.Count > 0)
            {
                List<double> rightConicalSlopeBaseDepthLists = rightConicalSlopeBaseDepths.Select(s => s.depthFoundation).ToList();
                this.cmb_OverallBaseDepthRight.DataSource = new List<double>(rightConicalSlopeBaseDepthLists);
                this.cmb_RightBaseDepth.DataSource = new List<double>(rightConicalSlopeBaseDepthLists);
                CommonData.Instance.ConicalSlope.ConicalSlopeRight.BaseDepth = rightConicalSlopeBaseDepthLists[0];
            }
            //左侧截水墙 铺砌厚度 截水墙厚度
            List<ConicalSlope> leLeftConicalSlope = httpRequestData.SelectAssembleLeftConicalSlope(CommonData.Instance.CommomTotal.GeneralDiagram);
            if (leLeftConicalSlope == null)
            {
                return;
            }
            if (leLeftConicalSlope.Count > 0)
            {
                CommonData.Instance.ConicalSlope.ConicalSlopeLeft.CutoffWallHeight = leLeftConicalSlope[0].highCutOffWall;
                CommonData.Instance.ConicalSlope.ConicalSlopeLeft.CutoffWallThickness = leLeftConicalSlope[0].cutOffWallThick;
                CommonData.Instance.ConicalSlope.ConicalSlopeLeft.PaveThickness = leLeftConicalSlope[0].thicknessPavingOpening;
            }
            //右侧截水墙 铺砌厚度 截水墙厚度
            List<ConicalSlope> righttConicalSlope = httpRequestData.SelectAssembleRightConicalSlope(this.cmb_StandardDrawing.Text);
            if (righttConicalSlope == null)
            {
                return;
            }
            if (righttConicalSlope.Count > 0)
            {
                CommonData.Instance.ConicalSlope.ConicalSlopeRight.CutoffWallHeight = righttConicalSlope[0].highCutOffWall;
                CommonData.Instance.ConicalSlope.ConicalSlopeRight.CutoffWallThickness = righttConicalSlope[0].cutOffWallThick;
                CommonData.Instance.ConicalSlope.ConicalSlopeRight.PaveThickness = righttConicalSlope[0].thicknessPavingOpening;
            }
            //左侧锥坡内侧襟边
            List<ConicalSlopeEdge> leftConicalSlopeEdge = httpRequestData.SelectAssembleLeftSideTaperedEdge(CommonData.Instance.CommomTotal.GeneralDiagram);
            List<double> leftConicalSlopeEdges = leftConicalSlopeEdge.Select(s => s.coneSlopeAccordingFrontEdge).ToList();
            if (leftConicalSlopeEdges == null)
            {
                return;
            }
            if (leftConicalSlopeEdges.Count > 0)
            {
                this.cmb_LeftMedialFlank.DataSource = new List<double>(leftConicalSlopeEdges);
                CommonData.Instance.ConicalSlope.ConicalSlopeLeft.CulvertInEdge = leftConicalSlopeEdges[0];
            }

            //右侧锥坡内侧襟边
            List<ConicalSlopeEdge> rightConicalSlopeEdge = httpRequestData.SelectAssembleRightSideTaperedEdge(CommonData.Instance.CommomTotal.GeneralDiagram);
            List<double> rightConicalSlopeEdges = rightConicalSlopeEdge.Select(s => s.coneSlopeAccordingFrontEdge).ToList();
            if (rightConicalSlopeEdges == null)
            {
                return;
            }
            if (rightConicalSlopeEdges.Count > 0)
            {
                this.cmb_RightMedialFlank.DataSource = new List<double>(rightConicalSlopeEdges);
                CommonData.Instance.ConicalSlope.ConicalSlopeRight.CulvertInEdge = rightConicalSlopeEdges[0];
            }
            #endregion
            #region 跌水井
            CommonData.Instance.DropWell.LeftDropWell.CenterLength = Convert.ToDouble(300);
            CommonData.Instance.DropWell.LeftDropWell.Deep = Convert.ToDouble(100);
            CommonData.Instance.DropWell.LeftDropWell.WellSlope = Convert.ToDouble(1);
            CommonData.Instance.DropWell.LeftDropWell.Height = Convert.ToDouble(30);
            CommonData.Instance.DropWell.LeftDropWell.DepthOfDrainageDitch = Convert.ToDouble(50);
            CommonData.Instance.DropWell.LeftDropWell.SlopOfDrainageDitch = Convert.ToDouble(50);
            CommonData.Instance.DropWell.LeftDropWell.Slope = Convert.ToDouble(0.25);
            CommonData.Instance.DropWell.LeftDropWell.SlopInsideDitch = Convert.ToDouble(1);
            CommonData.Instance.DropWell.LeftDropWell.SlopOutsideDitch = Convert.ToDouble(1.5);
            CommonData.Instance.DropWell.LeftDropWell.GutterPavingLength = Convert.ToDouble(100);
            CommonData.Instance.DropWell.LeftDropWell.PrecisionPavingHeight = Convert.ToDouble(60);
            CommonData.Instance.DropWell.LeftDropWell.InletSlop = Convert.ToDouble(0.25);
            CommonData.Instance.DropWell.LeftDropWell.SandPitDepthSwim = Convert.ToDouble(20);

            CommonData.Instance.DropWell.RightDropWell.CenterLength = Convert.ToDouble(300);
            CommonData.Instance.DropWell.RightDropWell.Deep = Convert.ToDouble(100);
            CommonData.Instance.DropWell.RightDropWell.WellSlope = Convert.ToDouble(1);
            CommonData.Instance.DropWell.RightDropWell.Height = Convert.ToDouble(30);
            CommonData.Instance.DropWell.RightDropWell.DepthOfDrainageDitch = Convert.ToDouble(50);
            CommonData.Instance.DropWell.RightDropWell.SlopOfDrainageDitch = Convert.ToDouble(50);
            CommonData.Instance.DropWell.RightDropWell.Slope = Convert.ToDouble(0.25);
            CommonData.Instance.DropWell.RightDropWell.SlopInsideDitch = Convert.ToDouble(1);
            CommonData.Instance.DropWell.RightDropWell.SlopOutsideDitch = Convert.ToDouble(1.5);
            CommonData.Instance.DropWell.RightDropWell.GutterPavingLength = Convert.ToDouble(100);
            CommonData.Instance.DropWell.RightDropWell.PrecisionPavingHeight = Convert.ToDouble(60);
            CommonData.Instance.DropWell.RightDropWell.InletSlop = Convert.ToDouble(0.25);
            CommonData.Instance.DropWell.RightDropWell.SandPitDepthSwim = Convert.ToDouble(20);
            #endregion
            #region 跌水
            //左跌水
            CommonData.Instance.HeadFall.LeftHeadFall.AngleFlare = 20;
            CommonData.Instance.HeadFall.LeftHeadFall.EndlongSlope = -20;
            CommonData.Instance.HeadFall.LeftHeadFall.SideWiden = 50;
            CommonData.Instance.HeadFall.LeftHeadFall.CutoffWallThickness = 40;
            CommonData.Instance.HeadFall.LeftHeadFall.PaveBottomThickness = 40;
            CommonData.Instance.HeadFall.LeftHeadFall.Height = 0;
            CommonData.Instance.HeadFall.LeftHeadFall.PaveLength = 400;
            CommonData.Instance.HeadFall.LeftHeadFall.CutoffWallHeight = 60;
            CommonData.Instance.HeadFall.LeftHeadFall.GutterwayDepth = 100;
            CommonData.Instance.HeadFall.LeftHeadFall.GutterrwayWallWidth = 20;
            CommonData.Instance.HeadFall.LeftHeadFall.GutterwaySlopeRatio = 0.15;
            //右跌水
            CommonData.Instance.HeadFall.RightHeadFall.AngleFlare = 20;
            CommonData.Instance.HeadFall.RightHeadFall.EndlongSlope = -20;
            CommonData.Instance.HeadFall.RightHeadFall.SideWiden = 50;
            CommonData.Instance.HeadFall.RightHeadFall.CutoffWallThickness = 40;
            CommonData.Instance.HeadFall.RightHeadFall.PaveBottomThickness = 40;
            CommonData.Instance.HeadFall.RightHeadFall.Height = 0;
            CommonData.Instance.HeadFall.RightHeadFall.PaveLength = 400;
            CommonData.Instance.HeadFall.RightHeadFall.CutoffWallHeight = 60;
            CommonData.Instance.HeadFall.RightHeadFall.GutterwayDepth = 100;
            CommonData.Instance.HeadFall.RightHeadFall.GutterrwayWallWidth = 20;
            CommonData.Instance.HeadFall.RightHeadFall.GutterwaySlopeRatio = 0.15;
            #endregion
            #region 排水槽
            //左排水槽
            CommonData.Instance.Rhone.LeftRhone.TopHeight = 200;
            CommonData.Instance.Rhone.LeftRhone.LowHeight = 50;
            CommonData.Instance.Rhone.LeftRhone.Length = 200;
            CommonData.Instance.Rhone.LeftRhone.LongitudinalSlopeOfEntrance = 0.01;
            CommonData.Instance.Rhone.LeftRhone.TopWidth = 30;
            CommonData.Instance.Rhone.LeftRhone.WidenOnOneSide = 100;
            CommonData.Instance.Rhone.LeftRhone.InsideGrade = 0;
            CommonData.Instance.Rhone.LeftRhone.OutsideGrade = 0.25;
            CommonData.Instance.Rhone.LeftRhone.GrooveBottomThickness = 30;
            //右排水槽
            CommonData.Instance.Rhone.RightRhone.TopHeight = 200;
            CommonData.Instance.Rhone.RightRhone.LowHeight = 50;
            CommonData.Instance.Rhone.RightRhone.Length = 200;
            CommonData.Instance.Rhone.RightRhone.LongitudinalSlopeOfEntrance = 0.01;
            CommonData.Instance.Rhone.RightRhone.TopWidth = 30;
            CommonData.Instance.Rhone.RightRhone.WidenOnOneSide = 100;
            CommonData.Instance.Rhone.RightRhone.InsideGrade = 0;
            CommonData.Instance.Rhone.RightRhone.OutsideGrade = 0.25;
            CommonData.Instance.Rhone.RightRhone.GrooveBottomThickness = 30;
            #endregion
            #region 边沟跌水井
            CommonData.Instance.SideDitchFallWellLeft.SideDitchFallWell_ShaftBottomThickness = 40;
            CommonData.Instance.SideDitchFallWellLeft.SideDitchFallWell_GritBasinDeep = 50;
            CommonData.Instance.SideDitchFallWellLeft.SideDitchFallWell_ShaftBottomCenterLength = 250;
            CommonData.Instance.SideDitchFallWellLeft.SideDitchFallWell_ShaftDeep = 256.8;
            CommonData.Instance.SideDitchFallWellLeft.SideDitchFallWell_ShaftWallTopWidth = 40;
            CommonData.Instance.SideDitchFallWellLeft.SideDitchFallWell_ShaftWallSlopeRatio = 0.25;
            CommonData.Instance.SideDitchFallWellLeft.SideDitchFallWell_ShaftOuterWidth = 50;
            CommonData.Instance.SideDitchFallWellLeft.SideDitchFallWell_ShaftOuterSlope = 0.1;
            CommonData.Instance.SideDitchFallWellLeft.SideDitchFallWell_SideDitchOutWallSetover = 50;
            CommonData.Instance.SideDitchFallWellLeft.SideDitchFallWell_SideDitchDeep = 85;
            CommonData.Instance.SideDitchFallWellLeft.SideDitchFallWell_SideDitchInSlopeRatio = 1.5;
            CommonData.Instance.SideDitchFallWellLeft.SideDitchFallWell_SideDitchBottomWidth = 60;
            CommonData.Instance.SideDitchFallWellLeft.SideDitchFallWell_SideDitchOutSlopeRatio = 1;
            CommonData.Instance.SideDitchFallWellLeft.SideDitchFallWell_OutWallMaskHeight = 100;
            CommonData.Instance.SideDitchFallWellLeft.SideDitchFallWell_MaskSlopeRatio = 1;
            CommonData.Instance.SideDitchFallWellLeft.SideDitchFallWell_FirstMemberStartTalkLength = 0;
            CommonData.Instance.SideDitchFallWellLeft.SideDitchFallWell_RightMemberStartTalkLength = 0;
            CommonData.Instance.SideDitchFallWellLeft.SideDitchFallWell_SideDitchDrawLength = 200;
            CommonData.Instance.SideDitchFallWellLeft.SideDitchFallWell_ShaftBottomEndlongSlope = 0;

            CommonData.Instance.SideDitchFallWellRight.SideDitchFallWell_ShaftBottomThickness = 40;
            CommonData.Instance.SideDitchFallWellRight.SideDitchFallWell_GritBasinDeep = 50;
            CommonData.Instance.SideDitchFallWellRight.SideDitchFallWell_ShaftBottomCenterLength = 250;
            CommonData.Instance.SideDitchFallWellRight.SideDitchFallWell_ShaftDeep = 256.8;
            CommonData.Instance.SideDitchFallWellRight.SideDitchFallWell_ShaftWallTopWidth = 40;
            CommonData.Instance.SideDitchFallWellRight.SideDitchFallWell_ShaftWallSlopeRatio = 0.25;
            CommonData.Instance.SideDitchFallWellRight.SideDitchFallWell_ShaftOuterWidth = 50;
            CommonData.Instance.SideDitchFallWellRight.SideDitchFallWell_ShaftOuterSlope = 0.1;
            CommonData.Instance.SideDitchFallWellRight.SideDitchFallWell_SideDitchOutWallSetover = 50;
            CommonData.Instance.SideDitchFallWellRight.SideDitchFallWell_SideDitchDeep = 85;
            CommonData.Instance.SideDitchFallWellRight.SideDitchFallWell_SideDitchInSlopeRatio = 1.5;
            CommonData.Instance.SideDitchFallWellRight.SideDitchFallWell_SideDitchBottomWidth = 60;
            CommonData.Instance.SideDitchFallWellRight.SideDitchFallWell_SideDitchOutSlopeRatio = 1;
            CommonData.Instance.SideDitchFallWellRight.SideDitchFallWell_OutWallMaskHeight = 100;
            CommonData.Instance.SideDitchFallWellRight.SideDitchFallWell_MaskSlopeRatio = 1;
            CommonData.Instance.SideDitchFallWellRight.SideDitchFallWell_FirstMemberStartTalkLength = 0;
            CommonData.Instance.SideDitchFallWellRight.SideDitchFallWell_RightMemberStartTalkLength = 0;
            CommonData.Instance.SideDitchFallWellRight.SideDitchFallWell_SideDitchDrawLength = 200;
            CommonData.Instance.SideDitchFallWellRight.SideDitchFallWell_ShaftBottomEndlongSlope = 0;

            #endregion
            #region 进口急流槽

            // 左侧
            CommonData.Instance.CommonChuteIn.LeftCommonChuteIn.Height = 300;
            CommonData.Instance.CommonChuteIn.LeftCommonChuteIn.BottomPaveThickness = 30;
            CommonData.Instance.CommonChuteIn.LeftCommonChuteIn.BodySlope = 1.5;
            CommonData.Instance.CommonChuteIn.LeftCommonChuteIn.ShaftBottomEndlongSlope = 0;
            CommonData.Instance.CommonChuteIn.LeftCommonChuteIn.ShaftBottomPaveThickness = 50;
            CommonData.Instance.CommonChuteIn.LeftCommonChuteIn.ShaftBottomBaseThickness = 30;
            CommonData.Instance.CommonChuteIn.LeftCommonChuteIn.ShaftBottomBaseDeep = 60;
            CommonData.Instance.CommonChuteIn.LeftCommonChuteIn.BaseEdgeThickness = 20;
            CommonData.Instance.CommonChuteIn.LeftCommonChuteIn.SinkFlowWallHeight = 60;
            CommonData.Instance.CommonChuteIn.LeftCommonChuteIn.SinkFlowWallLegth = 100;
            CommonData.Instance.CommonChuteIn.LeftCommonChuteIn.SinkFlowWallDiffusionRatio = 1;
            CommonData.Instance.CommonChuteIn.LeftCommonChuteIn.CutoffWallWidth = 40;
            CommonData.Instance.CommonChuteIn.LeftCommonChuteIn.CutoffWallHeight = 50;
            CommonData.Instance.CommonChuteIn.LeftCommonChuteIn.ShaftWallSlopeRatio = 0.25;
            CommonData.Instance.CommonChuteIn.LeftCommonChuteIn.TopWidth = 40;
            CommonData.Instance.CommonChuteIn.LeftCommonChuteIn.ShaftBottomCentreLength = 150;
            CommonData.Instance.CommonChuteIn.LeftCommonChuteIn.GritBasinDeep = 50;
            CommonData.Instance.CommonChuteIn.LeftCommonChuteIn.ShaftDeep = 150;
            CommonData.Instance.CommonChuteIn.LeftCommonChuteIn.EarWallInterval = 150;
            CommonData.Instance.CommonChuteIn.LeftCommonChuteIn.EarWallHeight = 30;
            CommonData.Instance.CommonChuteIn.LeftCommonChuteIn.EarWallWidth = 30;
            CommonData.Instance.CommonChuteIn.LeftCommonChuteIn.SideWiden = 0;

            // 右侧
            CommonData.Instance.CommonChuteIn.RightCommonChuteIn.Height = 350;
            CommonData.Instance.CommonChuteIn.RightCommonChuteIn.BottomPaveThickness = 30;
            CommonData.Instance.CommonChuteIn.RightCommonChuteIn.BodySlope = 1.5;
            CommonData.Instance.CommonChuteIn.RightCommonChuteIn.ShaftBottomEndlongSlope = 0;
            CommonData.Instance.CommonChuteIn.RightCommonChuteIn.ShaftBottomPaveThickness = 50;
            CommonData.Instance.CommonChuteIn.RightCommonChuteIn.ShaftBottomBaseThickness = 30;
            CommonData.Instance.CommonChuteIn.RightCommonChuteIn.ShaftBottomBaseDeep = 60;
            CommonData.Instance.CommonChuteIn.RightCommonChuteIn.BaseEdgeThickness = 20;
            CommonData.Instance.CommonChuteIn.RightCommonChuteIn.SinkFlowWallHeight = 60;
            CommonData.Instance.CommonChuteIn.RightCommonChuteIn.SinkFlowWallLegth = 100;
            CommonData.Instance.CommonChuteIn.RightCommonChuteIn.SinkFlowWallDiffusionRatio = 1;
            CommonData.Instance.CommonChuteIn.RightCommonChuteIn.CutoffWallWidth = 40;
            CommonData.Instance.CommonChuteIn.RightCommonChuteIn.CutoffWallHeight = 50;
            CommonData.Instance.CommonChuteIn.RightCommonChuteIn.ShaftWallSlopeRatio = 0.25;
            CommonData.Instance.CommonChuteIn.RightCommonChuteIn.TopWidth = 40;
            CommonData.Instance.CommonChuteIn.RightCommonChuteIn.ShaftBottomCentreLength = 150;
            CommonData.Instance.CommonChuteIn.RightCommonChuteIn.GritBasinDeep = 50;
            CommonData.Instance.CommonChuteIn.RightCommonChuteIn.ShaftDeep = 150;
            CommonData.Instance.CommonChuteIn.RightCommonChuteIn.EarWallInterval = 150;
            CommonData.Instance.CommonChuteIn.RightCommonChuteIn.EarWallHeight = 30;
            CommonData.Instance.CommonChuteIn.RightCommonChuteIn.EarWallWidth = 30;
            CommonData.Instance.CommonChuteIn.RightCommonChuteIn.SideWiden = 0;


            #endregion
            #region 出口急流槽

            // left
            CommonData.Instance.CommonChuteOut.LeftCommonChuteOut.Height = 300;
            CommonData.Instance.CommonChuteOut.LeftCommonChuteOut.EndlongSlopeRatio = 1.5;
            CommonData.Instance.CommonChuteOut.LeftCommonChuteOut.Deep = 50;
            CommonData.Instance.CommonChuteOut.LeftCommonChuteOut.DeflectionAngle = 0;
            CommonData.Instance.CommonChuteOut.LeftCommonChuteOut.BottomPaveThickness = 40;
            CommonData.Instance.CommonChuteOut.LeftCommonChuteOut.WallThickness = 50;
            CommonData.Instance.CommonChuteOut.LeftCommonChuteOut.WingWallLength = 100;
            CommonData.Instance.CommonChuteOut.LeftCommonChuteOut.WingWallAngleFlare = 15;
            CommonData.Instance.CommonChuteOut.LeftCommonChuteOut.CutoffWallHeight = 60;
            CommonData.Instance.CommonChuteOut.LeftCommonChuteOut.CutoffWallWidth = 40;
            CommonData.Instance.CommonChuteOut.LeftCommonChuteOut.EarWallHeight = 40;
            CommonData.Instance.CommonChuteOut.LeftCommonChuteOut.EarWallWidth = 40;
            CommonData.Instance.CommonChuteOut.LeftCommonChuteOut.EarWallInterval = 120;
            CommonData.Instance.CommonChuteOut.LeftCommonChuteOut.SideWidth = 0;

            // right
            CommonData.Instance.CommonChuteOut.RightCommonChuteOut.Height = 300;
            CommonData.Instance.CommonChuteOut.RightCommonChuteOut.EndlongSlopeRatio = 1.5;
            CommonData.Instance.CommonChuteOut.RightCommonChuteOut.Deep = 50;
            CommonData.Instance.CommonChuteOut.RightCommonChuteOut.DeflectionAngle = 0;
            CommonData.Instance.CommonChuteOut.RightCommonChuteOut.BottomPaveThickness = 40;
            CommonData.Instance.CommonChuteOut.RightCommonChuteOut.WallThickness = 50;
            CommonData.Instance.CommonChuteOut.RightCommonChuteOut.WingWallLength = 100;
            CommonData.Instance.CommonChuteOut.RightCommonChuteOut.WingWallAngleFlare = 15;
            CommonData.Instance.CommonChuteOut.RightCommonChuteOut.CutoffWallHeight = 60;
            CommonData.Instance.CommonChuteOut.RightCommonChuteOut.CutoffWallWidth = 40;
            CommonData.Instance.CommonChuteOut.RightCommonChuteOut.EarWallHeight = 40;
            CommonData.Instance.CommonChuteOut.RightCommonChuteOut.EarWallWidth = 40;
            CommonData.Instance.CommonChuteOut.RightCommonChuteOut.EarWallInterval = 120;
            CommonData.Instance.CommonChuteOut.RightCommonChuteOut.SideWidth = 0;


            #endregion
            #region 盖板参数
            //正盖板
            CommonData.Instance.CoverPlateParameter.FrontPlate.Length = 0;
            CommonData.Instance.CoverPlateParameter.FrontPlate.Width = 0;
            CommonData.Instance.CoverPlateParameter.FrontPlate.FulcrumThickness = 0;
            CommonData.Instance.CoverPlateParameter.FrontPlate.MidspanThickness = 0;
            this.cmb_CoverplateModel.Items.Clear();
            CommonData.Instance.CoverPlateParameter.FrontPlate.StandardPlateModel = "";
            this.cmb_ProtectiveLayer.Items.Clear();
            CommonData.Instance.CoverPlateParameter.FrontPlate.NetProtectiveLayer = 0;
            //左斜盖板
            CommonData.Instance.CoverPlateParameter.LeftInclinedPlate.Length = 0;
            CommonData.Instance.CoverPlateParameter.LeftInclinedPlate.ShortSideLength = 0;
            CommonData.Instance.CoverPlateParameter.LeftInclinedPlate.LongSideLength = 0;
            CommonData.Instance.CoverPlateParameter.LeftInclinedPlate.Thickness = 0;
            this.cmb_LeftCoverplateModel.Items.Clear();
            CommonData.Instance.CoverPlateParameter.LeftInclinedPlate.StandardPlateModel = "";
            this.cmb_LeftProtectiveLayer.Items.Clear();
            CommonData.Instance.CoverPlateParameter.LeftInclinedPlate.NetProtectiveLayer = 0;
            //右斜盖板
            CommonData.Instance.CoverPlateParameter.RightInclinedPlate.Length = 0;
            CommonData.Instance.CoverPlateParameter.RightInclinedPlate.ShortSideLength = 0;
            CommonData.Instance.CoverPlateParameter.RightInclinedPlate.LongSideLength = 0;
            CommonData.Instance.CoverPlateParameter.RightInclinedPlate.Thickness = 0;
            this.cmb_RightCoverplateModel.Items.Clear();
            CommonData.Instance.CoverPlateParameter.RightInclinedPlate.StandardPlateModel = "";
            this.cmb_RightProtectiveLayer.Items.Clear();
            CommonData.Instance.CoverPlateParameter.RightInclinedPlate.NetProtectiveLayer = 0;


            if (CommonData.Instance.CommomTotal.CoverPlateType == "预制")//(this.cmb_CoverplateType.Text == "预制")
            {
                //正盖板
                GetCellNameToModelName(CommonData.Instance.CommomTotal.GeneralDiagram, CommonData.Instance.CommomTotal.FillValue, CommonData.Instance.CommomTotal.ClearSpanHeadroom, null, null, ConstructionScheme.Precast, CulvertFoundationType.FrontCover);
                //左斜盖板
                GetCellNameToModelName(CommonData.Instance.CommomTotal.GeneralDiagram, CommonData.Instance.CommomTotal.FillValue, CommonData.Instance.CommomTotal.ClearSpanHeadroom, Math.Abs(90 - CommonData.Instance.CommomTotal.LeftAngle), InclinedPlate.Left, ConstructionScheme.Precast, CulvertFoundationType.InclinedCover);
                //右斜盖板
                GetCellNameToModelName(CommonData.Instance.CommomTotal.GeneralDiagram, CommonData.Instance.CommomTotal.FillValue, CommonData.Instance.CommomTotal.ClearSpanHeadroom, Math.Abs(90 - CommonData.Instance.CommomTotal.RightAngle), InclinedPlate.Right, ConstructionScheme.Precast, CulvertFoundationType.InclinedCover);
            }
            else
            {
                //正盖板
                GetCellNameToModelName(CommonData.Instance.CommomTotal.GeneralDiagram, CommonData.Instance.CommomTotal.FillValue, CommonData.Instance.CommomTotal.ClearSpanHeadroom, null, null, ConstructionScheme.CastInPlace, CulvertFoundationType.FrontCover);
                //左斜盖板
                GetCellNameToModelName(CommonData.Instance.CommomTotal.GeneralDiagram, CommonData.Instance.CommomTotal.FillValue, CommonData.Instance.CommomTotal.ClearSpanHeadroom, Math.Abs(90 - CommonData.Instance.CommomTotal.LeftAngle), InclinedPlate.Left, ConstructionScheme.CastInPlace, CulvertFoundationType.InclinedCover);
                //右斜盖板
                GetCellNameToModelName(CommonData.Instance.CommomTotal.GeneralDiagram, CommonData.Instance.CommomTotal.FillValue, CommonData.Instance.CommomTotal.ClearSpanHeadroom, Math.Abs(90 - CommonData.Instance.CommomTotal.RightAngle), InclinedPlate.Right, ConstructionScheme.CastInPlace, CulvertFoundationType.InclinedCover);
            }

            //左侧斜盖板
            //右侧斜盖板
            //沉降缝接头参数
            List<JointMaterial> settlementJointConnectors = httpRequestData.SelectAssembleQuantityStreetMaterials(CommonData.Instance.CommomTotal.GeneralDiagram);
            if (settlementJointConnectors == null)
            {
                return;
            }
            CommonData.Instance.CoverPlateParameter.SettlementJoint.FillMaterial = settlementJointConnectors[0].settlementJointFillingMaterial;
            CommonData.Instance.CoverPlateParameter.SettlementJoint.MainWrappingMaterial = settlementJointConnectors[0].settlementJointWrapsMainMaterial;
            CommonData.Instance.CoverPlateParameter.SettlementJoint.InternalPacking = settlementJointConnectors[0].internalPackingSettlementJoint;
            CommonData.Instance.CoverPlateParameter.SettlementJoint.UpperProtectiveLayer = settlementJointConnectors[0].settlingSeamUpperProtectiveLayer;
            #endregion
            CommonData.Instance.CommomTotal.WhetherGeneralDiagram = "是";
            tempSwitch = true;
        }

        void SetTxtData()
        {
            if (CommonData.Instance.CommomTotal.SelectAlignments.Count != 0)
            {
                switch (CommonData.Instance.CommomTotal.SelectAlignments.Count)
                {
                    case 1:
                        txt_Lines.Text = CommonData.Instance.CommomTotal.SelectAlignments[0].StationPrefix;
                        break;
                    case 2:
                        txt_Lines.Text = $"{CommonData.Instance.CommomTotal.SelectAlignments[0].StationPrefix};{CommonData.Instance.CommomTotal.SelectAlignments[1].StationPrefix}";
                        break;
                    case 3:
                        txt_Lines.Text = $"{CommonData.Instance.CommomTotal.SelectAlignments[0].StationPrefix};{CommonData.Instance.CommomTotal.SelectAlignments[1].StationPrefix};{CommonData.Instance.CommomTotal.SelectAlignments[2].StationPrefix}";
                        break;
                }

                txt_StartStation.Text = StationConvert.ConvertZH(CommonData.Instance.CommomTotal.SelectAlignments[0].StationPrefix, CommonData.Instance.CommomTotal.SelectAlignments[0].StaStation);
                txt_EndStation.Text = StationConvert.ConvertZH(CommonData.Instance.CommomTotal.SelectAlignments[0].StationPrefix, CommonData.Instance.CommomTotal.SelectAlignments[0].EndStation);
            }
        }



        #region 构造涵洞摆放矩阵
        //通过两个点, 获取X轴与该向量方向一致的单位矩阵变换(适用于二维空间变换)
        public static DMatrix3d GetDMatrix3dform2Pt(DPoint3d Sp, DPoint3d Ep)
        {
            double A90 = AtoX轴_加90(Sp, Ep);
            DPoint3d Ep90 = new DPoint3d(Sp.X + 10 * Math.Cos(A90), Sp.Y + 10 * Math.Sin(A90), 0);

            //DVector3d DVsp = new DVector3d(Sp);
            //DVector3d DVep = new DVector3d(Ep);
            //DVector3d DVep90 = new DVector3d(Ep90);

            //DVector3d X轴单位向量 = new DVector3d(Ep - Sp);
            //DVector3d Y轴单位向量 = new DVector3d(Ep90 - Sp);
            //DVector3d Z轴单位向量 = new DVector3d();
            //X轴单位向量.NormalizeInPlace();
            //Y轴单位向量.NormalizeInPlace();
            //Z轴单位向量.NormalizeInPlace();

            //DVector3d DVX = new DVector3d(X轴单位向量.X, Y轴单位向量.X, Z轴单位向量.X);
            //DVector3d DVY = new DVector3d(X轴单位向量.Y, Y轴单位向量.Y, Z轴单位向量.Y);
            //DVector3d DVZ = new DVector3d(X轴单位向量.Z, Y轴单位向量.Z, Z轴单位向量.Z);

            //DMatrix3d rMatrix = DMatrix3d.FromRows(DVX, DVY, DVZ);
            //DTransform3d trans = new DTransform3d(rMatrix);
            return CE单位矩阵(Sp, Ep, Ep90);
        }

        public static DMatrix3d CE单位矩阵(DPoint3d D矩阵原点, DPoint3d D矩阵X轴点, DPoint3d D矩阵Y轴点)
        {
            DMatrix3d rMatrix = new DMatrix3d();
            DVector3d V矩阵原点 = new DVector3d(D矩阵原点);
            DVector3d V矩阵X轴点 = new DVector3d(D矩阵X轴点);
            DVector3d V矩阵Y轴点 = new DVector3d(D矩阵Y轴点);

            DVector3d X轴单位向量 = new DVector3d();
            DVector3d Y轴单位向量 = new DVector3d();
            DVector3d Z轴单位向量 = new DVector3d();
            DVector3d Dnum = new DVector3d();

            //X轴单位向量
            Dnum = DVector3d.Subtract(V矩阵X轴点, V矩阵原点);
            //单位向量
            Dnum.NormalizeInPlace();
            //MessageBox.Show(Convert.ToString(DVector3d.Zero.Distance(Dnum)));
            X轴单位向量 = Dnum;

            //Y轴单位向量
            Dnum = DVector3d.Subtract(V矩阵Y轴点, V矩阵原点);
            //单位向量
            Dnum.NormalizeInPlace();
            //MessageBox.Show(Convert.ToString(DVector3d.Zero.Distance(Dnum)));
            Y轴单位向量 = Dnum;

            //Z轴单位向量
            Dnum = DVector3d.CrossProduct(X轴单位向量.X, X轴单位向量.Y, X轴单位向量.Z, Y轴单位向量.X, Y轴单位向量.Y, Y轴单位向量.Z);
            //单位向量
            Dnum.NormalizeInPlace();
            //MessageBox.Show(Convert.ToString(DVector3d.Zero.Distance(Dnum)));
            Z轴单位向量 = Dnum;

            DVector3d DVX = new DVector3d(X轴单位向量.X, Y轴单位向量.X, Z轴单位向量.X);
            DVector3d DVY = new DVector3d(X轴单位向量.Y, Y轴单位向量.Y, Z轴单位向量.Y);
            DVector3d DVZ = new DVector3d(X轴单位向量.Z, Y轴单位向量.Z, Z轴单位向量.Z);

            rMatrix = DMatrix3d.FromRows(DVX, DVY, DVZ);

            //MessageBox.Show(Convert.ToString(rMatrix.RowX.X + "/" + rMatrix.RowX.Y + "/" + rMatrix.RowX.Z));
            //MessageBox.Show(Convert.ToString(rMatrix.RowY.X + "/" + rMatrix.RowY.Y + "/" + rMatrix.RowY.Z));
            //MessageBox.Show(Convert.ToString(rMatrix.RowZ.X + "/" + rMatrix.RowZ.Y + "/" + rMatrix.RowZ.Z));

            return rMatrix;
        }


        //计算与X轴正向夹角+逆时针90度
        public static double AtoX轴_加90(DPoint3d sp, DPoint3d ep)
        {
            double X0 = sp.X;
            double Y0 = sp.Y;
            double X1 = ep.X;
            double Y1 = ep.Y;
            double AA;
            if (X1 == X0)
            {
                if (Y1 > Y0)
                {
                    AA = Math.PI;
                }
                else
                {
                    AA = 0;
                }
            }
            else
            {
                AA = Math.Abs(Math.Atan((Y1 - Y0) / (X1 - X0)));
                if (X1 >= X0 && Y1 >= Y0)
                {
                    AA = AA + Math.PI / 2;
                }
                else if (X1 >= X0 && Y1 < Y0)
                {
                    AA = 2 * Math.PI - AA + Math.PI / 2;
                    if (AA > 2 * Math.PI) AA = AA - 2 * Math.PI;
                }
                else if (X1 < X0 && Y1 < Y0)
                {
                    AA = Math.PI + AA + Math.PI / 2;
                }
                else
                {
                    AA = Math.PI - AA + Math.PI / 2;
                }
            }
            return AA;
        }
        #endregion

        /// <summary>
        /// 获取涵洞交线与边坡的交点
        /// </summary>
        /// <returns></returns>
        private (CulvertPointInfo entrancePointInfo, CulvertPointInfo exitPointInfo) GetDesignAlignment()
        {
            //(Alignment alignment, double bottomElevation, double angle, double disAlong) layLine = GetCulvertLine();

            //if (planSpace == null)
            //{
            //    return null;
            //}
            //LinearEntity2dInPlan linearEntity2dInPlan = planSpace.GetLinearEntity2dInPlanFactory().CreateLinearEntity2d(element) as LinearEntity2dInPlan;
            IObjectSpace objectSpase = RepositoryConnectionManager.Instance.GetActive().ObjectSpace;
            Bentley.CifNET.GeometryModel.GeometricModel geometricModel = Bentley.CifNET.GeometryModel.GeometricModel.GetGeometricModel(objectSpase, GetModelOptions.AllowDoNotExist);
            Bentley.CifNET.GeometryModel.PlanSpace planSpace = geometricModel.PlanSpace;

            LinearEntity2dInPlan mainLinear = ORDHelp.GetAllAlignmentsInModel(geometricModel).Find(p =>
                p.Name == CommonData.Instance.CommomTotal.SelectAlignments[0].ThisAlignment.Name &&
                p.Geometry.StartPoint.Coordinates == CommonData.Instance.CommomTotal.SelectAlignments[0].ThisAlignment.LinearGeometry.StartPoint.Coordinates &&
                p.Geometry.EndPoint.Coordinates == CommonData.Instance.CommomTotal.SelectAlignments[0].ThisAlignment.LinearGeometry.EndPoint.Coordinates);

            List<Bentley.CifNET.GeometryModel.LinearEntity2dInPlan> linearEntity2dInPlans = new List<Bentley.CifNET.GeometryModel.LinearEntity2dInPlan>();
            for (int i = 0; i < CommonData.Instance.CommomTotal.SelectAlignments.Count; i++)
            {
                if (i == 0) continue;

                linearEntity2dInPlans.Add(ORDHelp.GetAllAlignmentsInModel(geometricModel).Find(p => p.Name == CommonData.Instance.CommomTotal.SelectAlignments[i].ThisAlignment.Name &&
                    p.Geometry.StartPoint.Coordinates == CommonData.Instance.CommomTotal.SelectAlignments[i].ThisAlignment.LinearGeometry.StartPoint.Coordinates &&
                    p.Geometry.EndPoint.Coordinates == CommonData.Instance.CommomTotal.SelectAlignments[i].ThisAlignment.LinearGeometry.EndPoint.Coordinates));
            }

            //获取涵洞布置线与边坡交点信息
            CulvertLayoutParameter culvertLayoutParameter = new CulvertLayoutParameter(
                objectSpase,
                mainLinear,
                linearEntity2dInPlans,
                ORDHelp.GetAllAlignmentsInModel(geometricModel).Find(p => p.Name == CommonData.Instance.CulverIntersectingLine.Name &&
                    p.Geometry.StartPoint.Coordinates == CommonData.Instance.CulverIntersectingLine.LinearGeometry.StartPoint.Coordinates &&
                    p.Geometry.EndPoint.Coordinates == CommonData.Instance.CulverIntersectingLine.LinearGeometry.EndPoint.Coordinates),
                5.0,
                CommonData.Instance.CommomTotal.Slope
                );
            (CulvertPointInfo entrancePointInfo, CulvertPointInfo exitPointInfo) pointInfo = this.rbt_automaticCal.Checked == true ? culvertLayoutParameter.GetPointInfo()
                : culvertLayoutParameter.GetPointInfoByLength(CommonData.Instance.CommomTotal.LeftLength, CommonData.Instance.CommomTotal.RightLength,
                                                            CommonData.Instance.CommomTotal.LeftAngle, CommonData.Instance.CommomTotal.RightAngle);

            CommonData.Instance.EntrancePointInfo = pointInfo.entrancePointInfo;
            CommonData.Instance.ExitPointInfo = pointInfo.exitPointInfo;
            return pointInfo;
        }


        /// <summary>
        /// 获取根据XDATA名称获取元素Xdata数据
        /// </summary>
        /// <param name="ele">元素</param>
        /// <param name="xdataName">Xdata名称</param>
        /// <returns></returns>
        public static List<string> ElementGetXdata(Element ele, string xdataName)
        {
            List<string> infos = new List<string>();
            BIM.Element bimEE = SampleMixed.ElementOperation.ConvertToInteropEle(ele);
            BIM.XDataObject oXData = bimEE.GetXData1(xdataName);

            for (int i = 0; i < oXData.Count; i++)
            {
                if (oXData.GetXDatumType(i) == BIM.MsdXDatumType.String)
                {
                    infos.Add(oXData.GetXDatum(i).Value.ToString());
                }
            }
            return infos;
        }

        /// <summary>
        /// 获取选取涵洞线的单元ID
        /// </summary>
        /// <returns></returns>
        private string GetSelectLineDataId(ElementId elementId)
        {
            string result = "";
            Element element = GeneralHelpers.DefaultModel.FindElementById(elementId);
            if (element != null)
            {
                List<string> xDatas = ElementGetXdata(element, "涵洞设计线数据");
                if (xDatas.Count != 0)
                    result = xDatas[xDatas.Count - 1];
            }
            return result;
        }

        /// <summary>
        /// 获取涵洞交线
        /// </summary>
        /// <returns>涵洞中心顶线,涵洞中心顶线,涵洞布置线与主线夹角,涵洞布置线与主线交点桩号</returns>
        public (Alignment alignment, double bottomElevation, double angle, double disAlong) GetCulvertLine(bool isSetBingdingData)
        {
            CommonData.Instance.ElementIds.Clear();
            CommonData.Instance.LayLineIds.Add(CommonData.Instance.CommomTotal.SelectLine.ElementId.ToString());
            CommonData.Instance.LayLineIds.Add(GetSelectLineDataId(CommonData.Instance.CommomTotal.SelectLine.ElementId));

            if (isSetBingdingData)
            {
                string type = "";
                string jsonData = GetElementEc(CommonData.Instance.CommomTotal.SelectLine, out type);
                if (type == "盖板涵" && !string.IsNullOrWhiteSpace(jsonData))
                {
                    SetBindingDatas(JsonConvert.DeserializeObject<CommonData>(jsonData));
                }
            }

            //string sss = CommonData.Instance.CommomTotal.ClearSpanHeadroom;
            double clearHeight = Convert.ToDouble(CommonData.Instance.CommomTotal.ClearSpanHeadroom.Split('×')[1].Trim());
            double piecePlyHeight = this.cmb_BasicsType.Text == "整体式" ? Convert.ToDouble(this.txt_UnitaryPiecePly.Text) * 0.01 : Convert.ToDouble(this.txt_SeparatingPiecePly.Text) * 0.01;
            //切换到3D视图
            //Session.Instance.Keyin("vba run TwoView3D");
            //ORDHelp.FitSelectView(2, true, true, true);
            //创建涵洞布置路线
            LayingLineHelper layingLineHelper = new LayingLineHelper(
                CommonData.Instance.CommomTotal.SelectAlignments[0].ThisAlignment,
                CommonData.Instance.CommomTotal.SelectLine,
                clearHeight + piecePlyHeight,
                CommonData.Instance.CommomTotal.FillValue,
                CommonData.Instance.CommomTotal.Slope,
                5);
            var layLine = layingLineHelper.GetCulvertLayingLine();

            IObjectSpace objectSpase = RepositoryConnectionManager.Instance.GetActive().ObjectSpace;
            Bentley.CifNET.GeometryModel.GeometricModel geometricModel = Bentley.CifNET.GeometryModel.GeometricModel.GetGeometricModel(objectSpase, GetModelOptions.AllowDoNotExist);
            LinearEntity2dInPlan mainLinear = ORDHelp.GetAllAlignmentsInModel(geometricModel).Find(p => p.Name == layLine.alignment.Name &&
                p.Geometry.StartPoint.Coordinates == layLine.alignment.LinearGeometry.StartPoint.Coordinates &&
                p.Geometry.EndPoint.Coordinates == layLine.alignment.LinearGeometry.EndPoint.Coordinates);
            CommonData.Instance.linearEntity2DInPlan = mainLinear;

            CommonData.Instance.CommomTotal.CrossingAngle = (int)Math.Round(layLine.angle, 0);
            CommonData.Instance.CommomTotal.IntersectionPointDisAlong = layLine.disAlong;
            CommonData.Instance.CommomTotal.CulvertStackMark = StationConvert.ConvertZH(CommonData.Instance.CommomTotal.SelectAlignments[0].StationPrefix, Math.Round(layLine.disAlong + CommonData.Instance.CommomTotal.SelectAlignments[0].StaStation, 3));
            CommonData.Instance.CulverIntersectingLine = layLine.alignment;
            //CommonData.Instance.CommomTotal.Elevation = layLine.bottomElevation;

            this.txt_CulvertStake.Text = CommonData.Instance.CommomTotal.CulvertStackMark;
            this.tbox_CulvertCrossingAngle.Text = CommonData.Instance.CommomTotal.CrossingAngle.ToString();
            this.txt_CulvertBaseHeight.Text = Math.Round(CommonData.Instance.CommomTotal.Elevation, 4).ToString();

            //八字墙左右洞口偏角
            List<AliformAngleOfAvertence> aliformAngleOfAvertences = HttpRequestData.CreateHttpRequestData().GetAssembleSplayedWallAngles();
            AliformAngleOfAvertence aliformAngleOfAvertence = aliformAngleOfAvertences.Where(w => w.intersectionCulverts == Math.Round(layLine.angle)).ToList().First();
            CommonData.Instance.AliformWall.AliformWallLeft.ObeyAngle = aliformAngleOfAvertence.leftHoleAlongBeta;
            CommonData.Instance.AliformWall.AliformWallLeft.ContraryAngle = aliformAngleOfAvertence.leftOpeningCounterBeta;
            CommonData.Instance.AliformWall.AliformWallRight.ObeyAngle = aliformAngleOfAvertence.rightHoleAlongBeta;
            CommonData.Instance.AliformWall.AliformWallRight.ContraryAngle = aliformAngleOfAvertence.rightOpeningCounterBeta;

            #region 生成临时洞口元素
            try
            {
                if (CommonData.Instance.TempElements.Count > 0)
                    CommonData.Instance.TempElements.ForEach(f => f.DeleteFromModel());
            }
            catch (Exception ex)
            {
                CommonData.Instance.TempElements.Clear();
            }

            GetCulvertAlignmentInfo();
            CulvertLengthSubsection();
            if (CommonData.Instance.CulvertLength > 0 && CommonData.Instance.CommomTotal.LeftAngle != 0 && CommonData.Instance.CommomTotal.RightAngle != 0)
            {
                if (this.cmb_BasicsType.Text == "整体式")
                {
                    BasicConstructor basicConstructor = new BasicConstructor
                    {
                        BasicsLength = CommonData.Instance.CulvertLength,
                        LeftLateralAngle = CommonData.Instance.CommomTotal.LeftAngle,
                        RightLateralAngle = CommonData.Instance.CommomTotal.RightAngle,
                        CulvertGapWidth = Convert.ToDouble(this.txt_SedimentationWidth.Text),
                        BaseGapWidth = Convert.ToDouble(this.txt_BaseWidth.Text),
                        CulvertBaseSlope = Convert.ToDouble(this.txt_CulvertBaseSlope.Text),
                        ClearSpan = Convert.ToDouble(CommonData.Instance.CommomTotal.ClearSpanHeadroom.Split('×')[0].Trim()),
                        ClearHeight = Convert.ToDouble(CommonData.Instance.CommomTotal.ClearSpanHeadroom.Split('×')[1].Trim()),
                        PiecePly = Convert.ToDouble(this.txt_UnitaryPiecePly.Text),
                        BasicsEdge = Convert.ToDouble(this.txt_UnitaryBasics.Text),
                        StandPly = Convert.ToDouble(this.txt_UnitaryStandPly.Text),
                        StandTopWidth = Convert.ToDouble(this.txt_UnitaryStandTopWidth.Text),
                        BottomChamfer = Convert.ToDouble(this.txt_UnitaryBottomChamfer.Text),
                        BasicsPly = Convert.ToDouble(this.txt_UnitaryBasicsPly.Text),
                        ProtectiveLayer = Convert.ToDouble(this.cmb_UnitaryProtectiveLayer.Text),
                        ExchangeFillDepth = Convert.ToDouble(this.txt_ExchangeFillDepth.Text),
                        ExchangeFillLength = Convert.ToDouble(this.txt_ExchangeFillLength.Text),
                        ExchangeFillSlopeRatio = Convert.ToDouble(this.txt_ExchangeFillSlopeRatio.Text),
                        ExchangeFillEdge = Convert.ToDouble(this.txt_ExchangeFillEdge.Text)
                    };
                    DynamicCreateEntity dynamicCreateEntity = new DynamicCreateEntity(basicConstructor, CommonData.Instance.placePtDmatrix3d, CommonData.Instance.culvertPlacePoint3d, this.rbt_SeparatingSupport.Checked);
                    CommonData.Instance.TempElements.AddRange(dynamicCreateEntity.CreateUnitaryBasicModel());

                    //涵底标识线
                    LinearEntity2dInPlan linearEntity2DInPlan = layLine.alignment.DomainObject as LinearEntity2dInPlan;
                    DPoint3d staPT = linearEntity2DInPlan.ActiveLinearEntity3d.BaseGeometry.StartPoint.PointOnExtension;
                    DPoint3d endPT = linearEntity2DInPlan.ActiveLinearEntity3d.BaseGeometry.EndPoint.PointOnExtension;

                    double height = basicConstructor.PiecePly * 0.01 + basicConstructor.ClearHeight;
                    staPT.Z = staPT.Z - height;
                    endPT.Z = endPT.Z - height;
                    Bentley.DgnPlatformNET.Elements.LineElement showLine = new Bentley.DgnPlatformNET.Elements.LineElement(GeneralBank.Default3DModel, null, new DSegment3d(staPT * GeneralBank.UorToMeters, endPT * GeneralBank.UorToMeters));
                    showLine.AddToModel();
                    CommonData.Instance.TempElements.Add(showLine);
                }
                else
                {
                    //涵身钢筋数据
                    RebarEntity rebarData = SetDataGridViewData(CommonData.Instance.CommomTotal.GeneralDiagram, CommonData.Instance.CommomTotal.ClearSpanHeadroom, CommonData.Instance.CommomTotal.FillValue);
                    //获取涵身构造参数
                    BasicConstructor basicConstructor = new BasicConstructor
                    {
                        BracingBeamLength = rebarData.BracingBeamLength,
                        BracingBeamHeight = rebarData.BracingBeamHeight,
                        BracingBeamWidth = rebarData.BracingBeamWidth,
                        BracingBeamInterval = rebarData.BracingBeamInterval,
                        BasicsLength = CommonData.Instance.CulvertLength,
                        LeftLateralAngle = CommonData.Instance.CommomTotal.LeftAngle,
                        RightLateralAngle = CommonData.Instance.CommomTotal.RightAngle,
                        CulvertGapWidth = Convert.ToDouble(this.txt_SedimentationWidth.Text),
                        BaseGapWidth = Convert.ToDouble(this.txt_BaseWidth.Text),
                        CulvertBaseSlope = Convert.ToDouble(this.txt_CulvertBaseSlope.Text),
                        ClearSpan = Convert.ToDouble(CommonData.Instance.CommomTotal.ClearSpanHeadroom.Split('×')[0].Trim()),
                        ClearHeight = Convert.ToDouble(CommonData.Instance.CommomTotal.ClearSpanHeadroom.Split('×')[1].Trim()),
                        PiecePly = Convert.ToDouble(this.txt_SeparatingPiecePly.Text),
                        BasicsEdge = Convert.ToDouble(this.txt_SeparatingBasics.Text),
                        StandPly = Convert.ToDouble(this.txt_SeparatingStandPly.Text),
                        BasicWidth = Convert.ToDouble(txt_SeparatingBasicWidth.Text),
                        StandTopWidth = Convert.ToDouble(this.txt_SeparatingStandTopWidth.Text),
                        BasicsPly = Convert.ToDouble(this.txt_SeparatingBasicsPly.Text)
                    };
                    DynamicCreateEntity dynamicCreateEntity = new DynamicCreateEntity(basicConstructor, CommonData.Instance.placePtDmatrix3d, CommonData.Instance.culvertPlacePoint3d, this.rbt_SeparatingSupport.Checked);
                    CommonData.Instance.TempElements.AddRange(dynamicCreateEntity.CreateSeparatingBasicModel());

                    //涵底标识线
                    LinearEntity2dInPlan linearEntity2DInPlan = layLine.alignment.DomainObject as LinearEntity2dInPlan;
                    DPoint3d staPT = linearEntity2DInPlan.ActiveLinearEntity3d.BaseGeometry.StartPoint.PointOnExtension;
                    DPoint3d endPT = linearEntity2DInPlan.ActiveLinearEntity3d.BaseGeometry.EndPoint.PointOnExtension;
                    double height = basicConstructor.PiecePly * 0.01 + basicConstructor.ClearHeight;
                    if (this.rbt_SeparatingSupport.Checked)
                    {
                        height = height - basicConstructor.BracingBeamHeight * 0.01;
                    }

                    staPT.Z = staPT.Z - height;
                    endPT.Z = endPT.Z - height;
                    Bentley.DgnPlatformNET.Elements.LineElement showLine = new Bentley.DgnPlatformNET.Elements.LineElement(GeneralBank.Default3DModel, null, new DSegment3d(staPT * GeneralBank.UorToMeters, endPT * GeneralBank.UorToMeters));
                    showLine.AddToModel();
                    CommonData.Instance.TempElements.Add(showLine);
                }
            }
            #endregion
            if (CommonData.Instance.CommomTotal.WhetherGeneralDiagram == "是")
            {
                SelectGBCell();
            }
            return layLine;
        }

        private void btn_SelectLine_Click(object sender, EventArgs e)
        {
            SelectLineTool selectLineTool = new SelectLineTool(GetCulvertLine);
            selectLineTool.InstallTool();
        }

        private void pic_SelectLine_Click(object sender, EventArgs e)
        {
            if (Session.Instance.GetActiveDgnModel().Is3d)
            {
                MessageBox.Show("请切换至2D模型选择路线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, MessageBoxOptions.ServiceNotification);
                return;
            }
            SelectLines selectLines = new SelectLines(SetTxtData);
            selectLines.StartPosition = FormStartPosition.CenterScreen;
            selectLines.Show();
            Commands.mainForm.Hide();
        }

        private void btn_help_Click(object sender, EventArgs e)
        {
            double uorPerMeter = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMeter;
            long id = 925504;
            Element element = Session.Instance.GetActiveDgnModel().FindElementById(new ElementId(ref id));
            MeshHeaderElement meshElem = element as MeshHeaderElement;
            DPoint3d dp_1 = new DPoint3d(465269.99085 * uorPerMeter, 2895735.54518 * uorPerMeter, 1070.94083 * uorPerMeter);
            DPoint3d dp_3 = new DPoint3d(465226.03362 * uorPerMeter, 2895645.72446 * uorPerMeter, 1073.51383 * uorPerMeter);
            PolyfaceHeader pfh = meshElem.GetMeshData();
            CurveVector cv = pfh.DrapeLinestring(new List<DPoint3d>() { dp_1, dp_3 }, DVector3d.UnitZ);
            cv.GetStartEnd(out var drapLineStaPt, out var drapLineEndPt);

            var pt1 = drapLineStaPt * (1 / GeneralHelpers.UorToMeters);
            var pt2 = drapLineEndPt * (1 / GeneralHelpers.UorToMeters);
            //for (int i = 0; i < 1; i++)
            //{
            //    Element cellEE = PlaceSlab.InsertCellElement("广东版_1.5_[0.5，4)_1.0_0.2_", "C:\\Program Files\\CCCCLTD\\Highway BIM Solution\\ZJCulvert\\Resources\\Standards\\Cell\\圆管涵\\圆管涵_正管节.cel");
            //    //Element cellEE = PlaceSlab.InsertCellElement("广东版_2×2_(4.0，6.0]_15.0_2.36_0.73_0.35_0.35_0.035_通用", "C:\\Program Files\\CCCCLTD\\Highway BIM Solution\\ZJCulvert\\Resources\\Standards\\Cell\\盖板涵\\盖板涵_预制斜盖板.cel");
            //}
            //for (int i = 0; i < 10; i++)
            //{
            //    Element cellEE = PlaceSlab.InsertCellElement("广东版_1.5_10.0_[0，2000]_0.6_0.2_", "C:\\Program Files\\CCCCLTD\\Highway BIM Solution\\ZJCulvert\\Resources\\Standards\\Cell\\圆管涵\\圆管涵_斜管节.cel");
            //    //Element cellEE = PlaceSlab.InsertCellElement("广东版_2.0×2.0_(4.0，6.0]_2.36_0.99_0.35_0.35_0.035", "C:\\Program Files\\CCCCLTD\\Highway BIM Solution\\ZJCulvert\\Resources\\Standards\\Cell\\盖板涵\\盖板涵_预制正盖板（跨径2m、4m，Th=0.5~8）.cel");
            //}
            //for (int i = 0; i < 1; i++)
            //{
            //    //Element cellEE = PlaceSlab.InsertCellElement("广东版_2×2_(4.0，6.0]_15.0_2.36_0.73_0.35_0.35_0.035_通用", "C:\\Program Files\\CCCCLTD\\Highway BIM Solution\\ZJCulvert\\Resources\\Standards\\Cell\\盖板涵\\盖板涵_预制斜盖板.cel");
            //}


            //Bentley.Interop.MicroStationDGN.Application ComApp = Bentley.MstnPlatformNET.InteropServices.Utilities.ComApp;
            //string celLibName = "";
            //bool boo = ComApp.IsCellLibraryAttached;
            //if (boo == true) celLibName = ComApp.AttachedCellLibrary.FullName;

            //if (celLibName != "C:\\ProgramData\\Bentley\\OpenRoadsUltimateChina CE 10.10\\Configuration\\WorkSpaces\\CN_公路\\Standards\\Cell\\盖板涵\\盖板涵_预制正盖板（跨径2m、4m，Th=0.5~8）.cel")
            //{
            //    ComApp.AttachCellLibrary("C:\\ProgramData\\Bentley\\OpenRoadsUltimateChina CE 10.10\\Configuration\\WorkSpaces\\CN_公路\\Standards\\Cell\\盖板涵\\盖板涵_预制正盖板（跨径2m、4m，Th=0.5~8）.cel", Bentley.Interop.MicroStationDGN.MsdConversionMode.Prompt);
            //}
            //PlaceSlab placeSlab = new PlaceSlab();
            //placeSlab.InsertShardCell("金巴项目_4.0×3.0_[0.5，4.0]_4.56_0.99_0.45_0.45_0.035");

            //TerrainObj terrainObj = new TerrainObj();
            //List<DPoint3d> dPoints = new List<DPoint3d>();
            //dPoints.Add(new DPoint3d(477036.79710, 1273488.87780, 54.25796));
            //dPoints.Add(new DPoint3d(476853.20970, 1272858.36957, 53.88085));
            //DVector3d dVector3D = new DVector3d(dPoints[0], dPoints[1]);
            //dVector3D = dVector3D.RotateXY(Angle.FromDegrees(90));


            //CurveVector curveVector = terrainObj.DropLineToDTM(dPoints, dVector3D);
            //List<DPoint3d> drapPoints = new List<DPoint3d>();
            //curveVector.GetPrimitive(0).TryGetLineString(drapPoints);
            //Bentley.DgnPlatformNET.Elements.LineStringElement lineStringElement = new LineStringElement(Session.Instance.GetActiveDgnModel(), null, drapPoints.ToArray());
            //DTransform3d dTransform3D = DTransform3d.FromUniformScaleAndFixedPoint(DPoint3d.Zero, GeneralBank.UorToMeters);
            //lineStringElement.ApplyTransform(new TransformInfo(dTransform3D));
            //lineStringElement.AddToModel();
        }

        private void btn_RebarSize_Click(object sender, EventArgs e)
        {
            SeparatingRebarForm separatingRebarForm = new SeparatingRebarForm(CommonData.Instance.CommomTotal.GeneralDiagram, CommonData.Instance.CommomTotal.ClearSpanHeadroom, CommonData.Instance.CommomTotal.FillValue);
            separatingRebarForm.StartPosition = FormStartPosition.CenterScreen;
            separatingRebarForm.TopMost = true;
            separatingRebarForm.Show();
        }

        private void cmb_LeftCoverplateModel_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (this.cmb_CoverplateType.Text == "现浇")
            {
                if (this.cmb_LeftCoverplateModel.Text == "") return;
                string[] strings = this.cmb_LeftCoverplateModel.Text.ToString().Split('_');
                this.txt_LeftLength.Text = strings[2];
                this.txt_LeftShortLength.Text = strings[3];
                this.txt_LeftLongLength.Text = (Math.Round(Convert.ToDouble(strings[2]) * Math.Tan(Convert.ToDouble(strings[1]) * Math.PI / 180) + Convert.ToDouble(strings[3]), 4)).ToString();
                this.txt_LeftCoverplatePly.Text = strings[4];
                this.cmb_LeftProtectiveLayer.Text = strings[6];
            }
            else
            {
                if (this.cmb_LeftCoverplateModel.Text == "") return;
                string[] strings = cmb_LeftCoverplateModel.Text.ToString().Split('_');
                this.txt_LeftLength.Text = strings[4];
                this.txt_LeftShortLength.Text = strings[5];
                this.txt_LeftLongLength.Text = (Math.Round(Convert.ToDouble(strings[4]) * Math.Tan(Convert.ToDouble(strings[3]) * Math.PI / 180) + Convert.ToDouble(strings[5]), 4)).ToString();
                this.txt_LeftCoverplatePly.Text = strings[6];
                this.cmb_LeftProtectiveLayer.Text = strings[8];
            }

        }

        private void cmb_RightCoverplateModel_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (this.cmb_CoverplateType.Text == "现浇")
            {
                if (this.cmb_RightCoverplateModel.Text == "") return;
                string[] strings = this.cmb_RightCoverplateModel.Text.ToString().Split('_');
                this.txt_RightLength.Text = strings[2];
                this.txt_RightShortLength.Text = strings[3];
                this.txt_RightLongLength.Text = (Math.Round(Convert.ToDouble(strings[2]) * Math.Tan(Convert.ToDouble(strings[1]) * Math.PI / 180) + Convert.ToDouble(strings[3]), 4)).ToString();
                this.txt_RightCoverplatePly.Text = strings[4];
                this.cmb_RightProtectiveLayer.Text = strings[6];
            }
            else
            {
                if (this.cmb_RightCoverplateModel.Text == "") return;
                string[] strings = this.cmb_RightCoverplateModel.Text.ToString().Split('_');
                this.txt_RightLength.Text = strings[4];
                this.txt_RightShortLength.Text = strings[5];
                this.txt_RightLongLength.Text = (Math.Round(Convert.ToDouble(strings[4]) * Math.Tan(Convert.ToDouble(strings[3]) * Math.PI / 180) + Convert.ToDouble(strings[5]), 4)).ToString();
                this.txt_RightCoverplatePly.Text = strings[6];
                this.cmb_RightProtectiveLayer.Text = strings[8];
            }
        }

        private void txt_UnitaryCategory_SelectedIndexChanged(object sender, EventArgs e)
        {
            this.cmb_UnitaryProtectiveLayer.Items.Clear();

            HttpRequestData httpRequestData = HttpRequestData.CreateHttpRequestData();
            List<ProtectiveThickness> protectiveThicknesses = httpRequestData.SelectAssembleProtectiveThickness();

            //获取保护层数据

            foreach (var item in protectiveThicknesses)
            {
                if (item.environmentalCategory == this.txt_UnitaryCategory.Text)
                {
                    double min = item.minimumThickness;
                    double max = item.maximumThickness;
                    double gradient = item.gradient;

                    for (int i = 0; i < (Math.Round(max - min, 4)) / gradient + 1; i++)
                    {
                        double temp = min;
                        temp += i * gradient;
                        temp = Math.Round(temp, 3);
                        this.cmb_UnitaryProtectiveLayer.Items.Add(temp.ToString());
                    }
                }
            }
        }

        private void cmb_CoverplateType_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (tempSwitch == false)
                return;
            SelectGBCell();
        }

        private void cmb_LeftCave_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (!tempSwitch) return;

            if (this.cmb_LeftCave.Text == this.OverallEntranceCaveDatas[0])
            {
                this.lal_leftDetails1.Text = "基础埋深(cm)";
                this.lal_leftDetails2.Text = "内侧襟边(cm)";

                this.cmb_LeftBasicsDepth.Visible = true;
                this.cmb_LeftInsideEdge.Visible = true;

                this.cmb_OverallSlopeRatioLeft.Visible = false;
                this.cmb_OverallBaseDepthLeft.Visible = false;
            }
            else if (this.cmb_LeftCave.Text == this.OverallEntranceCaveDatas[1])
            {
                this.lal_leftDetails1.Text = "断面坡比(1:n)";
                this.lal_leftDetails2.Text = "基础深度(cm)";

                this.cmb_LeftBasicsDepth.Visible = false;
                this.cmb_LeftInsideEdge.Visible = false;

                this.cmb_OverallSlopeRatioLeft.Visible = true;
                this.cmb_OverallBaseDepthLeft.Visible = true;
            }
        }

        private void cmb_RightCave_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (!tempSwitch) return;

            if (this.cmb_RightCave.Text == this.OverallEntranceCaveDatas[0])
            {
                this.lal_RightDetails1.Text = "基础埋深(cm)";
                this.lal_RightDetails2.Text = "内侧襟边(cm)";

                this.cmb_RightBasicsDepth.Visible = true;
                this.cmb_RightInsideEdge.Visible = true;

                this.cmb_OverallSlopeRatioRight.Visible = false;
                this.cmb_OverallBaseDepthRight.Visible = false;
            }
            else if (this.cmb_RightCave.Text == this.OverallEntranceCaveDatas[1])
            {
                this.lal_RightDetails1.Text = "断面坡比(1:n)";
                this.lal_RightDetails2.Text = "基础深度(cm)";

                this.cmb_RightBasicsDepth.Visible = false;
                this.cmb_RightInsideEdge.Visible = false;

                this.cmb_OverallSlopeRatioRight.Visible = true;
                this.cmb_OverallBaseDepthRight.Visible = true;
            }
        }

        private void btn_UnitaryPicture_Click(object sender, EventArgs e)
        {
            MapUnitaryForm mapUnitaryForm = new MapUnitaryForm();
            mapUnitaryForm.Show();
        }

        private void btn_SeparatingPicture_Click(object sender, EventArgs e)
        {
            MapSeparatingForm mapSeparatingForm = new MapSeparatingForm();
            mapSeparatingForm.Show();
        }

        private RebarEntity SetDataGridViewData(string generalDiagram, string clearSpanAndHeight, double depthOfFill, string netProtectiveLayer)
        {
            List<string> dgv_Rebar1 = new List<string>();
            List<string> dgv_Rebar2 = new List<string>();
            List<string> dgv_Rebar2_1 = new List<string>();
            List<string> dgv_Rebar3 = new List<string>();
            List<string> dgv_Rebar4 = new List<string>();
            List<string> dgv_Rebar5 = new List<string>();
            List<string> dgv_Rebar6 = new List<string>();

            //1号钢筋
            HttpRequestData httpRequestData = HttpRequestData.CreateHttpRequestData();
            List<MonolithicNo1Rebar> monolithicNo1Rebars = httpRequestData.SelectAssembleMonolithicNo1s(CommonData.Instance.CommomTotal.GeneralDiagram);
            foreach (var item in monolithicNo1Rebars)
            {
                SpiltTh(item.fillHeight, out double min, out double max);
                if (depthOfFill >= min && depthOfFill <= max)
                {
                    if (item.standardDrawing == generalDiagram && item.clearSpan == clearSpanAndHeight)
                    {
                        dgv_Rebar1.AddRange(new string[] { item.barMargin.ToString(), item.rootNumber.ToString(), item.reinforcementType, item.diameterReinforcement.ToString() });
                    }
                }
            }
            //2号钢筋
            List<MonolithicNo2Rebar> monolithicNo2Rebars = httpRequestData.SelectAssembleMonolithicNo2s(CommonData.Instance.CommomTotal.GeneralDiagram);
            foreach (var item in monolithicNo2Rebars)
            {
                SpiltTh(item.fillHeight, out double min, out double max);
                if (depthOfFill >= min && depthOfFill <= max)
                {
                    if (item.standardDrawing == generalDiagram && item.clearSpan == clearSpanAndHeight)
                    {
                        dgv_Rebar2.AddRange(new string[] { item.marginNo2, item.rootsPerMeterTwo.ToString(), item.diameterReinforcement, item.reinforcementType, item.lengthOfNo2.ToString() });
                    }
                }
            }
            //2'号钢筋
            List<MonolithicNo2pRebar> monolithicNo2pRebars = httpRequestData.SelectAssembleMonolithicNo2p(CommonData.Instance.CommomTotal.GeneralDiagram);
            double Angle = 45;

            foreach (var item in monolithicNo2pRebars)
            {
                SpiltTh(item.fillHeight, out double min, out double max);
                if (depthOfFill >= min && depthOfFill <= max)
                {
                    if (item.clearSpan == clearSpanAndHeight)
                    {
                        if (Angle == 5)
                        {

                            dgv_Rebar2_1.AddRange(new string[] { item.marginNo2p.ToString(), item.degree5.ToString(), item.diameterReinforcement.ToString(), item.reinforcementType, dgv_Rebar2[4] });
                        }
                        else if (Angle == 10)
                        {
                            dgv_Rebar2_1.AddRange(new string[] { item.marginNo2p.ToString(), item.degree10.ToString(), item.diameterReinforcement.ToString(), item.reinforcementType, dgv_Rebar2[4] });
                        }
                        else if (Angle == 15)
                        {
                            dgv_Rebar2_1.AddRange(new string[] { item.marginNo2p.ToString(), item.degree15.ToString(), item.diameterReinforcement.ToString(), item.reinforcementType, dgv_Rebar2[4] });
                        }
                        else if (Angle == 20)
                        {
                            dgv_Rebar2_1.AddRange(new string[] { item.marginNo2p.ToString(), item.degree20.ToString(), item.diameterReinforcement.ToString(), item.reinforcementType, dgv_Rebar2[4] });
                        }
                        else if (Angle == 25)
                        {
                            dgv_Rebar2_1.AddRange(new string[] { item.marginNo2p.ToString(), item.degree25.ToString(), item.diameterReinforcement.ToString(), item.reinforcementType, dgv_Rebar2[4] });
                        }
                        else if (Angle == 30)
                        {
                            dgv_Rebar2_1.AddRange(new string[] { item.marginNo2p.ToString(), item.degree30.ToString(), item.diameterReinforcement.ToString(), item.reinforcementType, dgv_Rebar2[4] });
                        }
                        else if (Angle == 35)
                        {
                            dgv_Rebar2_1.AddRange(new string[] { item.marginNo2p.ToString(), item.degree35.ToString(), item.diameterReinforcement.ToString(), item.reinforcementType, dgv_Rebar2[4] });
                        }
                        else if (Angle == 40)
                        {
                            dgv_Rebar2_1.AddRange(new string[] { item.marginNo2p.ToString(), item.degree40.ToString(), item.diameterReinforcement.ToString(), item.reinforcementType, dgv_Rebar2[4] });
                        }
                        else
                            dgv_Rebar2_1.AddRange(new string[] { item.marginNo2p.ToString(), item.degree45.ToString(), item.diameterReinforcement.ToString(), item.reinforcementType, dgv_Rebar2[4] });
                    }
                }
            }
            //3号钢筋
            List<MonolithicNo3Rebar> monolithicNo3Rebars = httpRequestData.SelectAssembleMonolithicNo3s(CommonData.Instance.CommomTotal.GeneralDiagram);
            foreach (var item in monolithicNo3Rebars)
            {
                SpiltTh(item.fillHeight, out double min, out double max);
                if (depthOfFill >= min && depthOfFill <= max)
                {
                    if (item.standardDrawing == generalDiagram && item.clearSpan == clearSpanAndHeight)
                    {
                        dgv_Rebar3.AddRange(new string[] { item.insertionBaseDepth.ToString(), item.rootsPerMeterThree.ToString(), item.reinforcementType, item.diameterReinforcement.ToString(), item.barLength.ToString() });
                    }
                }
            }
            //4号钢筋
            List<MonolithicNo4Rebar> monolithicNo4Rebars = httpRequestData.SelectAssembleMonolithicNo4s(CommonData.Instance.CommomTotal.GeneralDiagram);
            foreach (var item in monolithicNo4Rebars)
            {
                SpiltTh(item.fillHeight, out double min, out double max);
                if (depthOfFill >= min && depthOfFill <= max)
                {
                    if (item.standardDrawing == generalDiagram && item.clearSpan == clearSpanAndHeight)
                    {
                        dgv_Rebar4.AddRange(new string[] { item.reinforcementSpacing, item.reinforcementType, item.diameterReinforcement.ToString(), item.barLength.ToString() });
                    }
                }
            }
            //5号钢筋
            List<MonolithicNo5Rebar> monolithicNo5Rebars = httpRequestData.SelectAssembleMonolithicNo5s(CommonData.Instance.CommomTotal.GeneralDiagram);
            foreach (var item in monolithicNo5Rebars)
            {
                SpiltTh(item.fillHeight, out double min, out double max);
                if (depthOfFill >= min && depthOfFill <= max)
                {
                    if (item.standardDrawing == generalDiagram && item.clearSpan == clearSpanAndHeight)
                    {
                        dgv_Rebar5.AddRange(new string[] { item.ipsilateralSpacing.ToString(), item.reinforcementType, item.diameterReinforcement.ToString(), item.numberBars.ToString() });
                    }
                }
            }
            //6号钢筋
            List<MonolithicNo6Rebar> monolithicNo6Rebars = httpRequestData.SelectAssembleMonolithicNo6s(CommonData.Instance.CommomTotal.GeneralDiagram);
            foreach (var item in monolithicNo6Rebars)
            {
                SpiltTh(item.fillHeight, out double min, out double max);
                if (depthOfFill >= min && depthOfFill <= max)
                {
                    if (item.standardDrawing == generalDiagram && item.clearSpan == clearSpanAndHeight)
                    {
                        dgv_Rebar6.AddRange(new string[] { netProtectiveLayer, item.reinforcementType, item.numberRootsPerMeter.ToString(), item.diameterReinforcement.ToString() });
                    }
                }
            }
            return new RebarEntity(dgv_Rebar1, dgv_Rebar2, dgv_Rebar2_1, dgv_Rebar3, dgv_Rebar4, dgv_Rebar5, dgv_Rebar6);
        }


        private RebarEntity SetDataGridViewData(string generalDiagram, string clearSpanAndHeight, double depthOfFill)
        {
            double BracingBeamLength = 0;
            double BracingBeamHeight = 0;
            double BracingBeamWidth = 0;
            double BracingBeamInterval = 7;
            List<string> dgv_Rebar1 = new List<string>();
            List<string> dgv_Rebar2 = new List<string>();

            HttpRequestData httpRequestData = HttpRequestData.CreateHttpRequestData();
            //尺寸
            List<SupportbeamDimension> supportbeamDimensions = httpRequestData.SelectAssembleSupportBeamDimension(generalDiagram);
            for (int i = 0; i < supportbeamDimensions.Count; i++)
            {
                if (supportbeamDimensions[i].standardDrawing == generalDiagram && supportbeamDimensions[i].clearSpan == clearSpanAndHeight)
                {
                    SpiltTh(supportbeamDimensions[i].fillHeight, out double min, out double max);
                    if (depthOfFill >= min && depthOfFill <= max)
                    {
                        BracingBeamLength = supportbeamDimensions[i].length;
                        BracingBeamHeight = supportbeamDimensions[i].height;
                        BracingBeamWidth = supportbeamDimensions[i].width;
                        break;
                    }
                }
            }
            //支撑梁1号钢筋
            List<SupportbeamNo1Rebar> supportbeamNo1Rebars = httpRequestData.SelectAssembleBracebeamNo1s(generalDiagram);
            foreach (var item in supportbeamNo1Rebars)
            {
                if (item.standardDrawing == generalDiagram && item.clearSpan == clearSpanAndHeight)
                {
                    SpiltTh(item.fillHeight, out double min, out double max);
                    if (depthOfFill >= min && depthOfFill <= max)
                    {
                        dgv_Rebar1.AddRange(new string[] { item.reinforcementType, item.reinforcementDiameter.ToString(), item.numberBars.ToString(), item.hookLength.ToString() });
                        break;
                    }
                }
            }

            //支撑梁2号钢筋
            List<SupportbeamNo2Rebar> supportbeamNo2Rebars = httpRequestData.SelectAssembleBracebeamNo2s(generalDiagram);
            foreach (var item in supportbeamNo2Rebars)
            {
                if (item.standardDrawing == generalDiagram && item.clearSpan == clearSpanAndHeight)
                {
                    SpiltTh(item.fillHeight, out double min, out double max);
                    if (depthOfFill >= min && depthOfFill <= max)
                    {
                        dgv_Rebar2.AddRange(new string[] { item.reinforcementType, item.reinforcementDiameter.ToString(), item.reinforcementAssembly, item.hookLength.ToString() });
                        break;
                    }
                }
            }
            return new RebarEntity(dgv_Rebar1, dgv_Rebar2, BracingBeamLength, BracingBeamHeight, BracingBeamWidth, BracingBeamInterval);
        }

        private void cb_IsExchangeFill_CheckedChanged(object sender, EventArgs e)
        {
            if (cb_IsExchangeFill.Checked == true)
            {
                gb_ExchangeFill.Enabled = true;
            }
            else
            {
                gb_ExchangeFill.Enabled = false;
            }
        }

        private void btn_ExchangeFillAdd_Click(object sender, EventArgs e)
        {
            dgv_ExchangeFill.Rows.Add();
            int index = dgv_ExchangeFill.RowCount - 1;
            dgv_ExchangeFill.Rows[index].Cells[0].Value = cmb_ExchangeFillMaterial.Text;
            ReplaceMentEntity replace = GetExchangeFill();
            string key = (index + 1) + "_" + replace.ExchangeFillMaterial;
            replaceMent.Add(key, replace);
        }


        private void ChangeValue(Dictionary<string, ReplaceMentEntity> oldReplaceMent)
        {
            if (dgv_ExchangeFill.RowCount == 0) return;

            int index = dgv_ExchangeFill.CurrentCell.RowIndex;
            string key = (index + 1) + "_" + dgv_ExchangeFill[0, index].Value.ToString();
            ReplaceMentEntity replace = GetExchangeFill();

            oldReplaceMent[key] = replace;
        }

        /// <summary>
        /// 添加行后, 直接将界面数据存入
        /// </summary>
        /// <returns></returns>
        private ReplaceMentEntity GetExchangeFill()
        {
            ReplaceMentEntity replace = new ReplaceMentEntity();
            replace.ExchangeFillDepth = Convert.ToDouble(txt_ExchangeFillDepth.Text);
            replace.ExchangeFillLength = Convert.ToDouble(txt_ExchangeFillLength.Text);
            replace.ExchangeFillDistance = Convert.ToDouble(txt_ExchangeFillDistance.Text);
            replace.ExchangeFillSlopeRatio = Convert.ToDouble(txt_ExchangeFillSlopeRatio.Text);
            replace.ExchangeFillEdge = Convert.ToDouble(txt_ExchangeFillEdge.Text);
            replace.ExchangeFillThickenLength = Convert.ToDouble(txt_ExchangeFillThickenLength.Text);
            replace.ExchangeFillThickenDepth = Convert.ToDouble(txt_ExchangeFillThickenDepth.Text);
            replace.ExchangeFillMaterial = cmb_ExchangeFillMaterial.Text;

            return replace;
        }

        private void btn_ExchangeFillDelete_Click(object sender, EventArgs e)
        {
            int or_index = dgv_ExchangeFill.CurrentCell.RowIndex;
            int index = dgv_ExchangeFill.CurrentCell.RowIndex;
            string key = (index + 1) + "_" + dgv_ExchangeFill[0, index].Value.ToString();
            replaceMent.Remove(key);

            if (index == replaceMent.Count) index -= 1;
            string afterKey = null;


            int i = 0;
            foreach (var item in replaceMent)
            {
                string originKey = item.Key;
                string newKey = (i + 1) + "_" + item.Key.Split('_')[1];

                if (i == index) afterKey = newKey;

                replaceMent = replaceMent.ToDictionary(k => k.Key == originKey ? newKey : k.Key, k => k.Value);
                i++;
            }
            dgv_ExchangeFill.Rows.RemoveAt(or_index);
        }

        private void dgv_ExchangeFill_SelectionChanged(object sender, EventArgs e)
        {
            if (dgv_ExchangeFill.RowCount == 0) return;

            int index = dgv_ExchangeFill.CurrentCell.RowIndex;
            if (null == dgv_ExchangeFill[0, index].Value) return;

            string key = (index + 1) + "_" + dgv_ExchangeFill[0, index].Value.ToString();

            ReplaceMentEntity replace = replaceMent[key];
            txt_ExchangeFillDepth.Text = replace.ExchangeFillDepth.ToString();
            txt_ExchangeFillLength.Text = replace.ExchangeFillLength.ToString();
            txt_ExchangeFillDistance.Text = replace.ExchangeFillDistance.ToString();
            txt_ExchangeFillSlopeRatio.Text = replace.ExchangeFillSlopeRatio.ToString();
            txt_ExchangeFillEdge.Text = replace.ExchangeFillEdge.ToString();
            txt_ExchangeFillThickenLength.Text = replace.ExchangeFillThickenLength.ToString();
            txt_ExchangeFillThickenDepth.Text = replace.ExchangeFillThickenDepth.ToString();
            cmb_ExchangeFillMaterial.Text = replace.ExchangeFillMaterial;
        }

        private void txt_ExchangeFillDepth_Leave(object sender, EventArgs e)
        {
            ChangeValue(replaceMent);
        }

        private void txt_ExchangeFillLength_Leave(object sender, EventArgs e)
        {
            ChangeValue(replaceMent);
        }

        private void txt_ExchangeFillDistance_Leave(object sender, EventArgs e)
        {
            ChangeValue(replaceMent);
        }

        private void txt_ExchangeFillSlopeRatio_Leave(object sender, EventArgs e)
        {
            ChangeValue(replaceMent);
        }

        private void txt_ExchangeFillEdge_Leave(object sender, EventArgs e)
        {
            ChangeValue(replaceMent);
        }

        private void txt_ExchangeFillThickenLength_Leave(object sender, EventArgs e)
        {
            ChangeValue(replaceMent);
        }

        private void txt_ExchangeFillThickenDepth_Leave(object sender, EventArgs e)
        {
            ChangeValue(replaceMent);
        }

        private void cmb_ClearSpanAndHeight_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (tempSwitch == false)
                return;

            SelectGBCell();

            if (tempSwitch)
                isAlter = true;

            WellDepth();
        }

        private void txt_Fill_TextChanged(object sender, EventArgs e)
        {
            if (tempSwitch)
                isAlter = true;
        }

        /// <summary>
        /// 返回单元名对应模型名
        /// </summary>
        /// <param name="standardDrawing">标准图</param>
        /// <param name="fillHeight">填土</param>
        /// <param name="clearSpan">净跨净空</param>
        /// <param name="Angle">角度</param>
        /// <param name="inclinedPlate">左斜盖板/右斜盖板</param>
        /// <param name="constructionMethod">预制/现浇</param>
        /// <param name="culvertFoundationType">正盖板/斜盖板</param>
        /// <returns></returns>
        private Dictionary<string, List<string>> GetCellNameToModelName(string standardDrawing, double fillHeight, string clearSpan, double? Angle, InclinedPlate? inclinedPlate, ConstructionScheme constructionMethod, CulvertFoundationType culvertFoundationType)
        {
            Dictionary<string, List<string>> cellDic = new Dictionary<string, List<string>>();
            string dgnFilePath = CommonData.Instance.WorkSpacePath + @"Standards\Cell\盖板涵\";
            string[] files = Directory.GetFiles(dgnFilePath, "*.*", SearchOption.AllDirectories);
            for (int i = 0; i < files.Length; i++)
            {
                if (files[i].Contains("现浇斜盖板") && constructionMethod == ConstructionScheme.CastInPlace && culvertFoundationType == CulvertFoundationType.InclinedCover)
                {
                    if (!files[i].Contains("=")) continue;
                    string[] temp = files[i].ToString().Split('=');
                    string temp2 = temp[1].ToString().Replace(").cel", "）.cel").Replace("）.cel", "");
                    string[] Range = temp2.ToString().Split(new char[] { '～', '~' });
                    if (Convert.ToDouble(fillHeight) >= Convert.ToDouble(Range[0]) && Convert.ToDouble(fillHeight) <= Convert.ToDouble(Range[1]))
                    {
                        int index = files[i].ToString().IndexOf("径");
                        var spanTemp = files[i].ToString().Substring(index + 1, 1);
                        if (Convert.ToDouble(clearSpan.Split('×')[0]) == Convert.ToDouble(spanTemp))
                        {
                            List<string> models = GetDgnFileModels(files[i]);
                            List<string> modelNames = new List<string>();
                            for (int m = 0; m < models.Count; m++)
                            {
                                string[] str = models[m].ToString().Split('_');
                                if (inclinedPlate == InclinedPlate.Left)
                                {
                                    if (Angle.ToString() == models[m].ToString().Split('_')[1])
                                    {
                                        if (!this.cmb_LeftProtectiveLayer.Items.Contains(str[6]))
                                        {
                                            this.cmb_LeftProtectiveLayer.Items.Add(str[6]);
                                        }
                                        if (this.cmb_LeftProtectiveLayer.Text.Trim() == "")
                                        {
                                            this.cmb_LeftProtectiveLayer.Text = str[6];
                                        }
                                        if (str[6] == this.cmb_LeftProtectiveLayer.Text)
                                        {
                                            if (!this.cmb_LeftCoverplateModel.Items.Contains(models[m]))
                                            {
                                                this.cmb_LeftCoverplateModel.Items.Add(models[m]);
                                            }

                                        }

                                        CmbDropDownWidth(this.cmb_LeftCoverplateModel);
                                        modelNames.Add(models[m]);
                                    }
                                }
                                else
                                {
                                    if (Angle.ToString() == models[m].ToString().Split('_')[1])
                                    {
                                        if (!this.cmb_RightProtectiveLayer.Items.Contains(str[6]))
                                        {
                                            this.cmb_RightProtectiveLayer.Items.Add(str[6]);
                                        }
                                        if (this.cmb_RightProtectiveLayer.Text.Trim() == "")
                                        {
                                            this.cmb_RightProtectiveLayer.Text = str[6];
                                        }
                                        if (str[6] == this.cmb_RightProtectiveLayer.Text)
                                        {
                                            if (!this.cmb_RightCoverplateModel.Items.Contains(models[m]))
                                            {
                                                this.cmb_RightCoverplateModel.Items.Add(models[m]);
                                            }
                                        }
                                        CmbDropDownWidth(this.cmb_RightCoverplateModel);
                                        modelNames.Add(models[m]);
                                    }
                                }
                            }
                            if (this.cmb_LeftCoverplateModel.Items.Count > 0)
                            {
                                this.cmb_LeftCoverplateModel.SelectedIndex = 0;
                                string[] strings = this.cmb_LeftCoverplateModel.Text.Split('_');
                                CommonData.Instance.CoverPlateParameter.LeftInclinedPlate.Length = Convert.ToDouble(strings[2]);
                                CommonData.Instance.CoverPlateParameter.LeftInclinedPlate.ShortSideLength = Convert.ToDouble(strings[3]);
                                CommonData.Instance.CoverPlateParameter.LeftInclinedPlate.LongSideLength = Math.Round(Convert.ToDouble(strings[2]) * Math.Tan(Convert.ToDouble(strings[1]) * Math.PI / 180) + Convert.ToDouble(strings[3]), 4);
                                CommonData.Instance.CoverPlateParameter.LeftInclinedPlate.Thickness = Convert.ToDouble(strings[4]);
                                CommonData.Instance.CoverPlateParameter.LeftInclinedPlate.StandardPlateModel = strings[4];
                            }
                            if (this.cmb_RightCoverplateModel.Items.Count > 0)
                            {
                                this.cmb_RightCoverplateModel.SelectedIndex = 0;
                                string[] strings = this.cmb_RightCoverplateModel.Text.Split('_');
                                CommonData.Instance.CoverPlateParameter.RightInclinedPlate.Length = Convert.ToDouble(strings[2]);
                                CommonData.Instance.CoverPlateParameter.RightInclinedPlate.ShortSideLength = Convert.ToDouble(strings[3]);
                                CommonData.Instance.CoverPlateParameter.RightInclinedPlate.LongSideLength = Math.Round(Convert.ToDouble(strings[2]) * Math.Tan(Convert.ToDouble(strings[1]) * Math.PI / 180) + Convert.ToDouble(strings[3]), 4);
                                CommonData.Instance.CoverPlateParameter.RightInclinedPlate.Thickness = Convert.ToDouble(strings[4]);
                                CommonData.Instance.CoverPlateParameter.RightInclinedPlate.StandardPlateModel = strings[4];
                            }
                            cellDic.Add(files[i], modelNames);
                        }
                    }
                }

                else if (files[i].Contains("预制斜盖板") && constructionMethod == ConstructionScheme.Precast && culvertFoundationType == CulvertFoundationType.InclinedCover)
                {
                    List<string> models = GetDgnFileModels(files[i]);
                    List<string> modelNames = new List<string>();
                    for (int k = 0; k < models.Count; k++)
                    {
                        string[] str = models[k].ToString().Split('_');
                        SpiltTh(str[2], out double min, out double max);

                        double clearWidth = Convert.ToDouble(clearSpan.Split('×')[0]);
                        double clearHeight = Convert.ToDouble(clearSpan.Split('×')[1]);
                        double strClearWidth = Convert.ToDouble(str[1].Split('×')[0]);
                        double strClearHeight = Convert.ToDouble(str[1].Split('×')[1]);

                        if (standardDrawing == str[0] && Convert.ToDouble(fillHeight) >= min && Convert.ToDouble(fillHeight) <= max && clearWidth == strClearWidth && clearHeight == strClearHeight && Angle.ToString() + ".0" == str[3])
                        {

                            if (inclinedPlate == InclinedPlate.Left)
                            {
                                if (!this.cmb_LeftProtectiveLayer.Items.Contains(str[8]))
                                {
                                    this.cmb_LeftProtectiveLayer.Items.Add(str[8]);
                                }
                                if (this.cmb_LeftProtectiveLayer.Text.Trim() == "")
                                {
                                    this.cmb_LeftProtectiveLayer.Text = str[8];
                                }

                                if (str[8] == this.cmb_LeftProtectiveLayer.Text)
                                {
                                    if (!this.cmb_LeftCoverplateModel.Items.Contains(models[k]))
                                    {
                                        this.cmb_LeftCoverplateModel.Items.Add(models[k]);
                                    }
                                }
                                CmbDropDownWidth(this.cmb_LeftCoverplateModel);
                                modelNames.Add(models[k]);
                            }
                            else
                            {
                                if (!cmb_RightProtectiveLayer.Items.Contains(str[8]))
                                {
                                    this.cmb_RightProtectiveLayer.Items.Add(str[8]);
                                }
                                if (this.cmb_RightProtectiveLayer.Text.Trim() == "")
                                {
                                    this.cmb_RightProtectiveLayer.Text = str[8];
                                }
                                if (str[8] == this.cmb_RightProtectiveLayer.Text)
                                {
                                    if (!this.cmb_RightCoverplateModel.Items.Contains(models[k]))
                                    {
                                        this.cmb_RightCoverplateModel.Items.Add(models[k]);
                                    }
                                }
                                CmbDropDownWidth(this.cmb_RightCoverplateModel);
                                modelNames.Add(models[k]);
                            }
                        }
                    }

                    if (this.cmb_LeftCoverplateModel.Items.Count > 0)
                    {
                        this.cmb_LeftCoverplateModel.SelectedIndex = 0;
                        string[] strings = this.cmb_LeftCoverplateModel.Text.Split('_');
                        CommonData.Instance.CoverPlateParameter.LeftInclinedPlate.Length = Convert.ToDouble(strings[4]);
                        CommonData.Instance.CoverPlateParameter.LeftInclinedPlate.ShortSideLength = Convert.ToDouble(strings[5]);
                        CommonData.Instance.CoverPlateParameter.LeftInclinedPlate.LongSideLength = Math.Round(Convert.ToDouble(strings[4]) * Math.Tan(Convert.ToDouble(strings[3]) * Math.PI / 180) + Convert.ToDouble(strings[5]), 4);
                        CommonData.Instance.CoverPlateParameter.LeftInclinedPlate.Thickness = Convert.ToDouble(strings[6]);
                        CommonData.Instance.CoverPlateParameter.LeftInclinedPlate.StandardPlateModel = strings[6];
                    }
                    if (this.cmb_RightCoverplateModel.Items.Count > 0)
                    {
                        this.cmb_RightCoverplateModel.SelectedIndex = 0;
                        string[] strings = this.cmb_RightCoverplateModel.Text.Split('_');
                        CommonData.Instance.CoverPlateParameter.LeftInclinedPlate.Length = Convert.ToDouble(strings[4]);
                        CommonData.Instance.CoverPlateParameter.LeftInclinedPlate.ShortSideLength = Convert.ToDouble(strings[5]);
                        CommonData.Instance.CoverPlateParameter.LeftInclinedPlate.LongSideLength = Math.Round(Convert.ToDouble(strings[4]) * Math.Tan(Convert.ToDouble(strings[3]) * Math.PI / 180) + Convert.ToDouble(strings[5]), 4);
                        CommonData.Instance.CoverPlateParameter.LeftInclinedPlate.Thickness = Convert.ToDouble(strings[6]);
                        CommonData.Instance.CoverPlateParameter.RightInclinedPlate.StandardPlateModel = strings[6];
                    }
                    cellDic.Add(files[i], modelNames);
                }
                else if (files[i].Contains("预制正盖板") && constructionMethod == ConstructionScheme.Precast && culvertFoundationType == CulvertFoundationType.FrontCover)
                {
                    List<string> models = GetDgnFileModels(files[i]);
                    List<string> modelNames = new List<string>();
                    for (int k = 0; k < models.Count; k++)
                    {
                        string[] str = models[k].ToString().Split('_');
                        SpiltTh(str[2], out double min, out double max);
                        double clearWidth = Convert.ToDouble(clearSpan.Split('×')[0]);
                        double clearHeight = Convert.ToDouble(clearSpan.Split('×')[1]);
                        double strClearWidth = Convert.ToDouble(str[1].Split('×')[0]);
                        double strClearHeight = Convert.ToDouble(str[1].Split('×')[1]);

                        if (standardDrawing == str[0] && Convert.ToDouble(fillHeight) >= min && Convert.ToDouble(fillHeight) <= max && clearWidth == strClearWidth && clearHeight == strClearHeight)
                        {
                            if (!cmb_ProtectiveLayer.Items.Contains(str[7]))
                            {
                                this.cmb_ProtectiveLayer.Items.Add(str[7]);
                            }
                            if (this.cmb_ProtectiveLayer.Text.Trim() == "")
                            {
                                this.cmb_ProtectiveLayer.Text = str[7];
                            }
                            if (str[7] == this.cmb_ProtectiveLayer.Text)
                            {
                                if (!this.cmb_CoverplateModel.Items.Contains(models[k]))
                                {
                                    this.cmb_CoverplateModel.Items.Add(models[k]);
                                }
                            }
                            modelNames.Add(models[k]);
                        }
                    }
                    if (this.cmb_CoverplateModel.Items.Count > 0)
                    {
                        this.cmb_CoverplateModel.SelectedIndex = 0;
                        string modelName = this.cmb_CoverplateModel.Text;
                        CommonData.Instance.CoverPlateParameter.FrontPlate.Length = Convert.ToDouble(modelName.Split('_')[3]);
                        CommonData.Instance.CoverPlateParameter.FrontPlate.Width = Convert.ToDouble(modelName.Split('_')[4]);
                        CommonData.Instance.CoverPlateParameter.FrontPlate.FulcrumThickness = Convert.ToDouble(modelName.Split('_')[5]);
                        CommonData.Instance.CoverPlateParameter.FrontPlate.MidspanThickness = Convert.ToDouble(modelName.Split('_')[6]);
                        CommonData.Instance.CoverPlateParameter.FrontPlate.StandardPlateModel = modelName;
                    }
                    cellDic.Add(files[i], modelNames);
                    CmbDropDownWidth(cmb_CoverplateModel);
                }
                else if (files[i].Contains("现浇正盖板") && constructionMethod == ConstructionScheme.CastInPlace && culvertFoundationType == CulvertFoundationType.FrontCover)
                {
                    List<string> modelNames = new List<string>();
                    if (!files[i].Contains("=")) continue;
                    string[] temp = files[i].ToString().Split('=');
                    string temp2 = temp[1].ToString().Replace(").cel", "）.cel").Replace("）.cel", "");
                    temp2 = temp2.Replace("-", "～");
                    string[] Range = temp2.ToString().Split(new char[] { '～', '~' });
                    if (Convert.ToDouble(fillHeight) >= Convert.ToDouble(Range[0]) && Convert.ToDouble(fillHeight) <= Convert.ToDouble(Range[1]))
                    {
                        int index = files[i].ToString().IndexOf("径");
                        var spanTemp = files[i].ToString().Substring(index + 1, 1);
                        if (Convert.ToDouble(clearSpan.Split('×')[0]) == Convert.ToDouble(spanTemp))
                        {
                            List<string> models = GetDgnFileModels(files[i]);
                            for (int k = 0; k < models.Count; k++)
                            {
                                string[] str = models[k].ToString().Split('_');

                                if (!this.cmb_ProtectiveLayer.Items.Contains(str[5]))
                                {
                                    this.cmb_ProtectiveLayer.Items.Add(str[5]);
                                }
                                if (this.cmb_ProtectiveLayer.Text.Trim() == "")
                                {
                                    this.cmb_ProtectiveLayer.Text = str[5];
                                }
                                if (str[5] == this.cmb_ProtectiveLayer.Text)
                                {
                                    if (!this.cmb_CoverplateModel.Items.Contains(models[k]))
                                    {
                                        this.cmb_CoverplateModel.Items.Add(models[k]);
                                    }
                                    //if (this.cmb_CoverplateModel.Text.Trim() == "")
                                    //{
                                    //    string modelName = models[k];
                                    //    this.cmb_CoverplateModel.Text = modelName;
                                    //    this.txt_Length.Text = modelName.Split('_')[1];
                                    //    this.txt_width.Text = modelName.Split('_')[2];
                                    //    this.txt_PointPly.Text = modelName.Split('_')[3];
                                    //    this.txt_MidSpanPly.Text = modelName.Split('_')[4];
                                    //}
                                }
                                modelNames.Add(models[k]);
                            }
                            if (this.cmb_CoverplateModel.Items.Count > 0)
                            {
                                this.cmb_CoverplateModel.SelectedIndex = 0;
                                string modelName = this.cmb_CoverplateModel.Text;
                                CommonData.Instance.CoverPlateParameter.FrontPlate.Length = Convert.ToDouble(modelName.Split('_')[1]);
                                CommonData.Instance.CoverPlateParameter.FrontPlate.Width = Convert.ToDouble(modelName.Split('_')[2]);
                                CommonData.Instance.CoverPlateParameter.FrontPlate.FulcrumThickness = Convert.ToDouble(modelName.Split('_')[3]);
                                CommonData.Instance.CoverPlateParameter.FrontPlate.MidspanThickness = Convert.ToDouble(modelName.Split('_')[4]);
                                CommonData.Instance.CoverPlateParameter.FrontPlate.StandardPlateModel = modelName;
                            }
                            cellDic.Add(files[i], modelNames);
                        }
                    }
                    CmbDropDownWidth(this.cmb_CoverplateModel);
                }
            }
            return cellDic;
        }



        private void SetCavernFoundation(BaseType baseType, string standardDrawing, double fillHeight, string clearSpan, ConstructionScheme constructionMethod)
        {
            HttpRequestData httpRequestData = HttpRequestData.CreateHttpRequestData();
            if (baseType == BaseType.Monolithic)
            {
                //整体式
                List<IntegralStructureSizeParameter> integralStructureSizeParameters = httpRequestData.SelectAssembleIntegralStructureDimensionParameter();
                if (integralStructureSizeParameters == null)
                {
                    return;
                }
                List<ProtectiveThickness> protectiveThicknesses = httpRequestData.SelectAssembleProtectiveThickness();
                if (protectiveThicknesses == null)
                {
                    return;
                }
                for (int i = 0; i < integralStructureSizeParameters.Count; i++)
                {
                    var type = this.constructionScheme == constructionMethod ? "现浇" : "预制";
                    if (integralStructureSizeParameters[i].name.Contains(standardDrawing) && integralStructureSizeParameters[i].clearSpan == clearSpan && integralStructureSizeParameters[i].form == type)
                    {
                        SpiltTh(integralStructureSizeParameters[i].fillHeight, out double min, out double max);
                        if (fillHeight >= min && fillHeight <= max)
                        {
                            this.txt_UnitaryPiecePly.Text = integralStructureSizeParameters[i].platformBodyBlockH1.ToString();
                            this.txt_UnitaryBasics.Text = integralStructureSizeParameters[i].baseFlapsideLengthC1.ToString();
                            this.txt_UnitaryStandPly.Text = integralStructureSizeParameters[i].bodyThicknessC2.ToString();
                            this.txt_UnitaryStandTopWidth.Text = integralStructureSizeParameters[i].platformWidthC4.ToString();
                            this.txt_UnitaryBottomChamfer.Text = integralStructureSizeParameters[i].bottomChamferC7.ToString();
                            this.txt_UnitaryBasicsPly.Text = integralStructureSizeParameters[i].baseThicknessHd.ToString();
                            this.txt_UnitaryBearing.Text = integralStructureSizeParameters[i].allowableBearingCapacityFoundation.ToString();
                            this.txt_UnitaryCategory.DataSource = httpRequestData.SelectAssembleProtectiveThickness().Select(s => s.environmentalCategory).ToList();
                            this.cmb_UnitaryProtectiveLayer.Items.Clear();

                            //this.cmb_UnitaryProtectiveLayer.DataSource = httpRequestData.SelectAssembleProtectiveThickness().Select(s => s.recommended).ToList();

                            double minValue = protectiveThicknesses[0].minimumThickness;
                            double maxValue = protectiveThicknesses[0].maximumThickness;
                            double gradient = protectiveThicknesses[0].gradient;
                            for (int m = 0; m < (maxValue - minValue) / gradient + 1; m++)
                            {
                                double temp = minValue;
                                temp += m * gradient;
                                temp = Math.Round(temp, 3);
                                this.cmb_UnitaryProtectiveLayer.Items.Add(temp.ToString());
                            }
                            this.cmb_UnitaryProtectiveLayer.Text = protectiveThicknesses[0].recommended.ToString();
                            //break;
                        }
                    }
                }
            }
            else
            {
                //分离式
                List<SeparateStructureSizeParameter> separateStructureSizeParameters = httpRequestData.SelectAssembleSeparateStructureParameters();
                if (separateStructureSizeParameters == null)
                {
                    return;
                }
                for (int i = 0; i < separateStructureSizeParameters.Count; i++)
                {
                    var type = this.constructionScheme == constructionMethod ? "现浇" : "预制";
                    if (separateStructureSizeParameters[i].name.Contains(standardDrawing) && separateStructureSizeParameters[i].clearSpan == clearSpan && separateStructureSizeParameters[i].form == type)
                    {
                        SpiltTh(separateStructureSizeParameters[i].fillHeight, out double min, out double max);
                        if (fillHeight >= min && fillHeight <= max)
                        {
                            this.txt_SeparatingPiecePly.Text = separateStructureSizeParameters[i].platformBodyBlockH1.ToString();
                            this.txt_SeparatingBasics.Text = separateStructureSizeParameters[i].baseFlapsideLengthC1.ToString();
                            this.txt_SeparatingStandPly.Text = separateStructureSizeParameters[i].bodyThicknessC2.ToString();
                            this.txt_SeparatingBasicWidth.Text = separateStructureSizeParameters[i].splitBaseWidthC3.ToString();
                            this.txt_SeparatingStandTopWidth.Text = separateStructureSizeParameters[i].platformBodyWidthC4.ToString();
                            this.txt_SeparatingBasicsPly.Text = separateStructureSizeParameters[i].separatedBaseThicknessHd.ToString();
                            this.txt_SeparatingBearing.Text = separateStructureSizeParameters[i].allowableBearingCapacityFoundation.ToString();
                            //break;
                        }
                    }
                }
            }
        }

        private void cmb_CoverplateModel_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (((ComboBox)sender).DataSource == null) return;
            string[] str = cmb_CoverplateModel.Text.ToString().Split('_');

            if (this.cmb_CoverplateType.Text == "预制")
            {
                txt_Length.Text = str[3];
                txt_width.Text = str[4];
                txt_PointPly.Text = str[5];
                txt_MidSpanPly.Text = str[6];
                cmb_ProtectiveLayer.Text = str[7];
            }
            else
            {
                txt_Length.Text = str[1];
                txt_width.Text = str[2];
                txt_PointPly.Text = str[3];
                txt_MidSpanPly.Text = str[4];
                cmb_ProtectiveLayer.Text = str[5];
            }
        }

        private void cmb_LeftEndWallBackSlope_SelectedIndexChanged(object sender, EventArgs e)
        {
            HttpRequestData httpRequestData = HttpRequestData.CreateHttpRequestData();
            List<EndWallSearchEntry> endWallBackSlopes = httpRequestData.SelectAssembleEndWallSearch(CommonData.Instance.CommomTotal.GeneralDiagram);
            if (endWallBackSlopes == null)
            {
                return;
            }
            //端墙基础埋深
            List<double> endWallBaseBurialDepthLists = endWallBackSlopes.Where(s => s.slopeWallBack == Convert.ToDouble(this.cmb_LeftEndWallBackSlope.Text)).ToList().Select(z => z.buriedDepthFoundation).ToList();
            this.cmb_LeftEndWallBaseBurialDepth.DataSource = endWallBaseBurialDepthLists;
        }

        private void cmb_RightEndWallBackSlope_SelectedIndexChanged(object sender, EventArgs e)
        {
            HttpRequestData httpRequestData = HttpRequestData.CreateHttpRequestData();
            List<EndWallSearchEntry> endWallBackSlopes = httpRequestData.SelectAssembleEndWallSearch(CommonData.Instance.CommomTotal.GeneralDiagram);
            if (endWallBackSlopes == null)
            {
                return;
            }
            //端墙基础埋深
            List<double> endWallBaseBurialDepthLists = endWallBackSlopes.Where(s => s.slopeWallBack == Convert.ToDouble(this.cmb_RightEndWallBackSlope.Text)).ToList().Select(z => z.buriedDepthFoundation).ToList();
            this.cmb_RightEndWallBaseBurialDepth.DataSource = endWallBaseBurialDepthLists;
        }

        private void txt_CulvertBaseSlope_TextChanged(object sender, EventArgs e)
        {
            this.txt_LeftPavingSlope.Text = this.txt_CulvertBaseSlope.Text;
            this.txt_RightPavingSlope.Text = this.txt_CulvertBaseSlope.Text;
            if (tempSwitch)
                isAlter = true;
        }

        private void cmb_ProtectiveLayer_SelectedIndexChanged(object sender, EventArgs e)
        {
            this.cmb_CoverplateModel.Items.Clear();
            this.cmb_CoverplateModel.Text = "";
            if (this.cmb_CoverplateType.Text == "预制")
            {
                //正盖板
                GetCellNameToModelName(CommonData.Instance.CommomTotal.GeneralDiagram, CommonData.Instance.CommomTotal.FillValue, CommonData.Instance.CommomTotal.ClearSpanHeadroom, null, null, ConstructionScheme.Precast, CulvertFoundationType.FrontCover);
            }
            else
            {
                //正盖板
                GetCellNameToModelName(CommonData.Instance.CommomTotal.GeneralDiagram, CommonData.Instance.CommomTotal.FillValue, CommonData.Instance.CommomTotal.ClearSpanHeadroom, null, null, ConstructionScheme.CastInPlace, CulvertFoundationType.FrontCover);
            }
        }

        private void cmb_LeftProtectiveLayer_SelectedIndexChanged(object sender, EventArgs e)
        {
            this.cmb_LeftCoverplateModel.Items.Clear();
            this.cmb_LeftCoverplateModel.Text = "";
            if (this.cmb_CoverplateType.Text == "预制")
            {
                //左斜盖板
                GetCellNameToModelName(CommonData.Instance.CommomTotal.GeneralDiagram, CommonData.Instance.CommomTotal.FillValue, CommonData.Instance.CommomTotal.ClearSpanHeadroom, Math.Abs(90 - CommonData.Instance.CommomTotal.LeftAngle), InclinedPlate.Left, ConstructionScheme.Precast, CulvertFoundationType.InclinedCover);
            }
            else
            {
                //左斜盖板
                GetCellNameToModelName(CommonData.Instance.CommomTotal.GeneralDiagram, CommonData.Instance.CommomTotal.FillValue, CommonData.Instance.CommomTotal.ClearSpanHeadroom, Math.Abs(90 - CommonData.Instance.CommomTotal.LeftAngle), InclinedPlate.Left, ConstructionScheme.CastInPlace, CulvertFoundationType.InclinedCover);
            }
        }

        private void cmb_RightProtectiveLayer_SelectedIndexChanged(object sender, EventArgs e)
        {
            this.cmb_RightCoverplateModel.Items.Clear();
            this.cmb_RightCoverplateModel.Text = "";
            if (this.cmb_CoverplateType.Text == "预制")
            {
                //右斜盖板
                GetCellNameToModelName(CommonData.Instance.CommomTotal.GeneralDiagram, CommonData.Instance.CommomTotal.FillValue, CommonData.Instance.CommomTotal.ClearSpanHeadroom, Math.Abs(90 - CommonData.Instance.CommomTotal.RightAngle), InclinedPlate.Right, ConstructionScheme.Precast, CulvertFoundationType.InclinedCover);
            }
            else
            {
                //右斜盖板
                GetCellNameToModelName(CommonData.Instance.CommomTotal.GeneralDiagram, CommonData.Instance.CommomTotal.FillValue, CommonData.Instance.CommomTotal.ClearSpanHeadroom, Math.Abs(90 - CommonData.Instance.CommomTotal.RightAngle), InclinedPlate.Right, ConstructionScheme.CastInPlace, CulvertFoundationType.InclinedCover);
            }
        }

        private void cmb_BasicsType_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (tempSwitch == false)
                return;
            if (this.cmb_BasicsType.Text == "整体式")
            {
                this.rbt_SeparatingNoSupport.Enabled = false;
                this.rbt_SeparatingSupport.Enabled = false;
                this.btn_RebarSize.Enabled = false;
                this.btn_Rebar.Enabled = true;
            }
            else
            {
                this.rbt_SeparatingNoSupport.Enabled = true;
                this.rbt_SeparatingSupport.Enabled = true;
                this.btn_RebarSize.Enabled = true;
                this.btn_Rebar.Enabled = false;
            }
        }

        private void cmb_IsAisle_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (tempSwitch == false)
                return;
            switch (cmb_IsAisle.SelectedIndex)
            {
                case 0:
                    isAisle = false;
                    break;
                case 1:
                    isAisle = true;
                    break;
                default:
                    break;
            }
        }

        private void rbt_GoInPinzi_Click(object sender, EventArgs e)
        {
            if (this.rbt_GoInPinzi.Checked)
            {
                this.txt_OverHeightIn.Enabled = false;
                this.txt_OverallEmbeddedIn.Enabled = false;
                this.rbt_FlushIn.Checked = true;
            }
        }

        private void rbt_GoInEmbed_Click(object sender, EventArgs e)
        {
            if (this.rbt_GoInEmbed.Checked)
            {
                this.txt_OverHeightIn.Enabled = true;
                this.txt_OverallEmbeddedIn.Enabled = true;
                this.rbt_EmbeddedIn.Checked = true;
            }
        }

        private void txt_OverallEmbeddedIn_TextChanged(object sender, EventArgs e)
        {
            this.txt_OverHeightIn.Text = this.txt_OverallEmbeddedIn.Text;
        }

        private void rbt_GoOutExtension_Click(object sender, EventArgs e)
        {
            if (this.rbt_GoOutExtension.Checked)
            {
                this.rbt_ExtensionOut.Checked = true;
            }
        }

        private void rbt_GoOutEmbed_Click(object sender, EventArgs e)
        {
            if (this.rbt_GoOutEmbed.Checked)
            {
                this.rbt_InlineOut.Checked = true;
            }
        }

        #region 分段窗体分段页事件
        private void rbt_FlushIn_Click(object sender, EventArgs e)
        {
            if (this.rbt_FlushIn.Checked)
            {
                this.txt_OverHeightIn.Enabled = false;
                this.txt_OverallEmbeddedIn.Enabled = false;
                this.rbt_GoInPinzi.Checked = true;
            }
        }

        private void rbt_EmbeddedIn_Click(object sender, EventArgs e)
        {
            if (this.rbt_EmbeddedIn.Checked)
            {
                this.txt_OverHeightIn.Enabled = true;
                this.txt_OverallEmbeddedIn.Enabled = true;
                this.rbt_GoInEmbed.Checked = true;
            }
        }

        private void txt_OverHeightIn_Click(object sender, EventArgs e)
        {
            this.txt_OverallEmbeddedIn.Text = this.txt_OverHeightIn.Text;
        }

        private void rbt_ExtensionOut_Click(object sender, EventArgs e)
        {
            if (this.rbt_ExtensionOut.Checked)
            {
                this.rbt_GoOutExtension.Checked = true;
            }
        }

        private void rbt_InlineOut_Click(object sender, EventArgs e)
        {
            if (this.rbt_InlineOut.Checked)
            {
                this.rbt_GoOutEmbed.Checked = true;
            }
        }
        #endregion


        private void dgv_Slot_CellValueChanged(object sender, DataGridViewCellEventArgs e)
        {
            DataGridView dataGridView = sender as DataGridView;
            if (e.ColumnIndex == 2)
            {
                DataGridViewCell dataCell = dataGridView.CurrentCell;
                if (dataCell == null) return;
                if (dataCell.ColumnIndex != 2) return;
                if (Convert.ToBoolean(dataCell.Value) == true)
                {
                    double sum = 0;
                    for (int i = 1; i < dataGridView.Rows.Count - 1; i++)
                    {
                        sum += Convert.ToDouble(dataGridView[1, i].Value);
                        DataGridViewCheckBoxCell cell = (DataGridViewCheckBoxCell)dataGridView[2, i];
                        if (Convert.ToBoolean(cell.Value) == true)
                        {
                            if (!(sum >= Convert.ToDouble(this.txt_MinDistance.Text) * 100 && sum <= Convert.ToDouble(this.txt_MaxDistance.Text) * 100))
                            {
                                this.dgv_Slot[2, e.RowIndex].Value = false;
                                this.dgv_Slot.RefreshEdit();
                                return;
                            }
                            sum = 0;
                        }
                    }
                }

            }
        }

        private void dgv_Slot_CurrentCellDirtyStateChanged(object sender, EventArgs e)
        {
            //提交改变，触发dataGridView1_CellValueChanged事件，以便及时获取check的值改变事件
            if (dgv_Slot.IsCurrentCellDirty)
                dgv_Slot.CommitEdit(DataGridViewDataErrorContexts.Commit);

        }

        private void dgv_Slot_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {

        }

        private void txt_Fill_Leave(object sender, EventArgs e)
        {
            if (!tempSwitch) return;
            if (!isAlter) return;
            double clearHeight = Convert.ToDouble(CommonData.Instance.CommomTotal.ClearSpanHeadroom.Split('×')[1].Trim());
            double piecePlyHeight = this.cmb_BasicsType.Text == "整体式" ? Convert.ToDouble(this.txt_UnitaryPiecePly.Text) * 0.01 : Convert.ToDouble(this.txt_SeparatingPiecePly.Text) * 0.01;
            //var linearPonint = CommonData.Instance.CommomTotal.SelectAlignments[0].ThisAlignment.ActiveLinearEntity3d.LinearGeometry.GetPointAtDistanceOffset(CommonData.Instance.CommomTotal.IntersectionPointDisAlong, 0);
            var linearPonint = GetIntersectionPoint();
            CommonData.Instance.CommomTotal.Elevation = linearPonint.Coordinates.Z - (clearHeight + piecePlyHeight);
            if (CommonData.Instance.CulverIntersectingLine != null)
            {
                //删除涵洞线
                Bentley.CifNET.GeometryModel.SDK.Alignment alignment = AlignmentProperty.seachTagetAlignment(CommonData.Instance.CulverIntersectingLine);
                if (alignment != null)
                {
                    if (alignment.ActiveLinearEntity3d != null) alignment.ActiveLinearEntity3d.Element.DeleteFromModel();
                }
                CommonData.Instance.CulverIntersectingLine.Element.DeleteFromModel();

                GetCulvertLine(false);
                CulvertLengthSubsection();
                CalLeftAndRightCulvertLength();
            }

            if (this.txt_StartStation.Text == "")
            {
                return;
            }
            //刷新盖板
            SelectGBCell();
            isAlter = false;
        }


        public void SelectGBCell()
        {
            //正盖板
            CommonData.Instance.CoverPlateParameter.FrontPlate.Length = 0;
            CommonData.Instance.CoverPlateParameter.FrontPlate.Width = 0;
            CommonData.Instance.CoverPlateParameter.FrontPlate.FulcrumThickness = 0;
            CommonData.Instance.CoverPlateParameter.FrontPlate.MidspanThickness = 0;
            this.cmb_CoverplateModel.Items.Clear();
            CommonData.Instance.CoverPlateParameter.FrontPlate.StandardPlateModel = "";
            this.cmb_ProtectiveLayer.Items.Clear();
            CommonData.Instance.CoverPlateParameter.FrontPlate.NetProtectiveLayer = 0;
            //左斜盖板
            CommonData.Instance.CoverPlateParameter.LeftInclinedPlate.Length = 0;
            CommonData.Instance.CoverPlateParameter.LeftInclinedPlate.ShortSideLength = 0;
            CommonData.Instance.CoverPlateParameter.LeftInclinedPlate.LongSideLength = 0;
            CommonData.Instance.CoverPlateParameter.LeftInclinedPlate.Thickness = 0;
            this.cmb_LeftCoverplateModel.Items.Clear();
            CommonData.Instance.CoverPlateParameter.LeftInclinedPlate.StandardPlateModel = "";
            this.cmb_LeftProtectiveLayer.Items.Clear();
            CommonData.Instance.CoverPlateParameter.LeftInclinedPlate.NetProtectiveLayer = 0;
            //右斜盖板
            CommonData.Instance.CoverPlateParameter.RightInclinedPlate.Length = 0;
            CommonData.Instance.CoverPlateParameter.RightInclinedPlate.ShortSideLength = 0;
            CommonData.Instance.CoverPlateParameter.RightInclinedPlate.LongSideLength = 0;
            CommonData.Instance.CoverPlateParameter.RightInclinedPlate.Thickness = 0;
            this.cmb_RightCoverplateModel.Items.Clear();
            CommonData.Instance.CoverPlateParameter.RightInclinedPlate.StandardPlateModel = "";
            this.cmb_RightProtectiveLayer.Items.Clear();
            CommonData.Instance.CoverPlateParameter.RightInclinedPlate.NetProtectiveLayer = 0;


            if (CommonData.Instance.CommomTotal.CoverPlateType == "预制")//(this.cmb_CoverplateType.Text == "预制")
            {
                //正盖板
                GetCellNameToModelName(CommonData.Instance.CommomTotal.GeneralDiagram, CommonData.Instance.CommomTotal.FillValue, CommonData.Instance.CommomTotal.ClearSpanHeadroom, null, null, ConstructionScheme.Precast, CulvertFoundationType.FrontCover);
                //左斜盖板
                GetCellNameToModelName(CommonData.Instance.CommomTotal.GeneralDiagram, CommonData.Instance.CommomTotal.FillValue, CommonData.Instance.CommomTotal.ClearSpanHeadroom, Math.Abs(90 - CommonData.Instance.CommomTotal.LeftAngle), InclinedPlate.Left, ConstructionScheme.Precast, CulvertFoundationType.InclinedCover);
                //右斜盖板
                GetCellNameToModelName(CommonData.Instance.CommomTotal.GeneralDiagram, CommonData.Instance.CommomTotal.FillValue, CommonData.Instance.CommomTotal.ClearSpanHeadroom, Math.Abs(90 - CommonData.Instance.CommomTotal.RightAngle), InclinedPlate.Right, ConstructionScheme.Precast, CulvertFoundationType.InclinedCover);
                var baseType = this.baseType == this.baseType ? "整体式" : "分离式";
                //洞身基础
                if (this.cmb_BasicsType.Text == baseType)
                {
                    SetCavernFoundation(BaseType.Monolithic, CommonData.Instance.CommomTotal.GeneralDiagram, CommonData.Instance.CommomTotal.FillValue, CommonData.Instance.CommomTotal.ClearSpanHeadroom, ConstructionScheme.Precast);
                }
                else
                {
                    SetCavernFoundation(BaseType.Detached, CommonData.Instance.CommomTotal.GeneralDiagram, CommonData.Instance.CommomTotal.FillValue, CommonData.Instance.CommomTotal.ClearSpanHeadroom, ConstructionScheme.Precast);
                }
            }
            else
            {
                //正盖板
                GetCellNameToModelName(CommonData.Instance.CommomTotal.GeneralDiagram, CommonData.Instance.CommomTotal.FillValue, CommonData.Instance.CommomTotal.ClearSpanHeadroom, null, null, ConstructionScheme.CastInPlace, CulvertFoundationType.FrontCover);
                //左斜盖板
                GetCellNameToModelName(CommonData.Instance.CommomTotal.GeneralDiagram, CommonData.Instance.CommomTotal.FillValue, CommonData.Instance.CommomTotal.ClearSpanHeadroom, Math.Abs(90 - CommonData.Instance.CommomTotal.LeftAngle), InclinedPlate.Left, ConstructionScheme.CastInPlace, CulvertFoundationType.InclinedCover);
                //右斜盖板
                GetCellNameToModelName(CommonData.Instance.CommomTotal.GeneralDiagram, CommonData.Instance.CommomTotal.FillValue, CommonData.Instance.CommomTotal.ClearSpanHeadroom, Math.Abs(90 - CommonData.Instance.CommomTotal.RightAngle), InclinedPlate.Right, ConstructionScheme.CastInPlace, CulvertFoundationType.InclinedCover);
                var baseType = this.baseType == this.baseType ? "整体式" : "分离式";
                //洞身基础
                if (cmb_BasicsType.Text == baseType)
                {
                    SetCavernFoundation(BaseType.Monolithic, CommonData.Instance.CommomTotal.GeneralDiagram, CommonData.Instance.CommomTotal.FillValue, CommonData.Instance.CommomTotal.ClearSpanHeadroom, ConstructionScheme.CastInPlace);
                }
                else
                {
                    SetCavernFoundation(BaseType.Detached, CommonData.Instance.CommomTotal.GeneralDiagram, CommonData.Instance.CommomTotal.FillValue, CommonData.Instance.CommomTotal.ClearSpanHeadroom, ConstructionScheme.CastInPlace);
                }
            }
        }

        /// <summary>
        /// 获取路线与涵洞线在路线上的交点
        /// </summary>
        /// <returns></returns>
        private LinearPoint GetIntersectionPoint()
        {
            CommonData.Instance.CommomTotal.SelectLine.GetCurveVector().GetStartEnd(out var startPoint, out _, out var startTangent, out _);
            var resultPts = CommonData.Instance.CommomTotal.SelectAlignments[0].ThisAlignment.ActiveLinearEntity3d.LinearGeometry.Intersect(startPoint * (1 / GeneralHelpers.UorToMeters), startTangent, 0.001);
            var points = CommonData.Instance.CommomTotal.SelectAlignments[0].ThisAlignment.BaseLinearGeometry.Intersect(startPoint * (1 / GeneralHelpers.UorToMeters), startTangent, 0.001);
            LinearPoint ss = CommonData.Instance.CommomTotal.SelectAlignments[0].ThisAlignment.BaseLinearGeometry.StartPoint;
            if (points != null && points.Count != 0)
            {
                List<double> doubles = new List<double>();
                for (int i = 0; i < points.Count; i++)
                {
                    doubles.Add(startPoint.DistanceXY(points.Item(i).PointOn1.Coordinates * GeneralHelpers.UorToMeters));
                }
                return resultPts.Item(doubles.IndexOf(doubles.Min())).PointOn1;
            }
            return null;
        }

        private void txt_CulvertBaseHeight_Leave(object sender, EventArgs e)
        {
            if (!tempSwitch) return;
            if (!isAlter) return;
            double clearHeight = Convert.ToDouble(CommonData.Instance.CommomTotal.ClearSpanHeadroom.Split('×')[1].Trim());
            double piecePlyHeight = this.cmb_BasicsType.Text == "整体式" ? Convert.ToDouble(this.txt_UnitaryPiecePly.Text) * 0.01 : Convert.ToDouble(this.txt_SeparatingPiecePly.Text) * 0.01;
            //var linearPonint = CommonData.Instance.CommomTotal.SelectAlignments[0].ThisAlignment.ActiveLinearEntity3d.LinearGeometry.GetPointAtDistanceOffset(CommonData.Instance.CommomTotal.IntersectionPointDisAlong, 0);
            var linearPonint = GetIntersectionPoint();
            var heightDifferenceSum = Math.Abs(CommonData.Instance.CommomTotal.Elevation - linearPonint.Coordinates.Z);

            CommonData.Instance.CommomTotal.FillValue = Math.Round(heightDifferenceSum - (clearHeight + piecePlyHeight), 4);

            //删除涵洞线
            Bentley.CifNET.GeometryModel.SDK.Alignment alignment = AlignmentProperty.seachTagetAlignment(CommonData.Instance.CulverIntersectingLine);
            if (alignment != null)
            {
                if (alignment.ActiveLinearEntity3d != null) alignment.ActiveLinearEntity3d.Element.DeleteFromModel();
            }
            CommonData.Instance.CulverIntersectingLine.Element.DeleteFromModel();
            CommonData.Instance.CulverIntersectingLine = null;
            GetCulvertLine(false);
            CalLeftAndRightCulvertLength();
            isAlter = false;
        }

        private void txt_CulvertBaseHeight_TextChanged(object sender, EventArgs e)
        {
            if (tempSwitch)
                isAlter = true;
        }

        private void txt_CulvertBaseSlope_Leave(object sender, EventArgs e)
        {
            if (!tempSwitch)
                return;
            if (!isAlter) return;
            double clearHeight = Convert.ToDouble(CommonData.Instance.CommomTotal.ClearSpanHeadroom.Split('×')[1].Trim());
            double piecePlyHeight = this.cmb_BasicsType.Text == "整体式" ? Convert.ToDouble(this.txt_UnitaryPiecePly.Text) * 0.01 : Convert.ToDouble(this.txt_SeparatingPiecePly.Text) * 0.01;
            //var linearPonint = CommonData.Instance.CommomTotal.SelectAlignments[0].ThisAlignment.ActiveLinearEntity3d.LinearGeometry.GetPointAtDistanceOffset(CommonData.Instance.CommomTotal.IntersectionPointDisAlong, 0);
            var linearPonint = GetIntersectionPoint();
            CommonData.Instance.CommomTotal.Elevation = linearPonint.Coordinates.Z - (clearHeight + piecePlyHeight);
            if (CommonData.Instance.CulverIntersectingLine != null)
            {
                //删除涵洞线
                Bentley.CifNET.GeometryModel.SDK.Alignment alignment = AlignmentProperty.seachTagetAlignment(CommonData.Instance.CulverIntersectingLine);
                if (alignment != null)
                {
                    if (alignment.ActiveLinearEntity3d != null) alignment.ActiveLinearEntity3d.Element.DeleteFromModel();
                }
                CommonData.Instance.CulverIntersectingLine.Element.DeleteFromModel();
                GetCulvertLine(false);
                CulvertLengthSubsection();
                CalLeftAndRightCulvertLength();
            }
            isAlter = false;
        }

        private void cmb_ClearSpanAndHeight_Leave(object sender, EventArgs e)
        {
            if (!isAlter) return;
            double clearHeight = Convert.ToDouble(CommonData.Instance.CommomTotal.ClearSpanHeadroom.Split('×')[1].Trim());
            double piecePlyHeight = this.cmb_BasicsType.Text == "整体式" ? Convert.ToDouble(this.txt_UnitaryPiecePly.Text) * 0.01 : Convert.ToDouble(this.txt_SeparatingPiecePly.Text) * 0.01;
            var linearPonint = CommonData.Instance.CommomTotal.SelectAlignments[0].ThisAlignment.ActiveLinearEntity3d.LinearGeometry.GetPointAtDistanceOffset(CommonData.Instance.CommomTotal.IntersectionPointDisAlong, 0);

            CommonData.Instance.CommomTotal.Elevation = linearPonint.Coordinates.Z - (clearHeight + piecePlyHeight);
            if (CommonData.Instance.CulverIntersectingLine != null)
            {
                //删除涵洞线
                Bentley.CifNET.GeometryModel.SDK.Alignment alignment = AlignmentProperty.seachTagetAlignment(CommonData.Instance.CulverIntersectingLine);
                if (alignment != null)
                {
                    if (alignment.ActiveLinearEntity3d != null) alignment.ActiveLinearEntity3d.Element.DeleteFromModel();
                }
                CommonData.Instance.CulverIntersectingLine.Element.DeleteFromModel();

                GetCulvertLine(false);
            }
            isAlter = false;
        }

        private void panel_Bottom_Paint(object sender, PaintEventArgs e)
        {

        }

        private void cmb_StandardDrawing_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (tempSwitch)
                GetDBCulvertData();
        }

        private void rbt_automaticCal_CheckedChanged(object sender, EventArgs e)
        {
            if (this.rbt_automaticCal.Checked == true)
            {
                this.btn_ProfileCalculate.Enabled = true;
                this.txt_LeftCulverLength.Enabled = false;
                this.txt_RightCulverLength.Enabled = false;
                this.txt_LeftCaveAngle.Enabled = false;
                this.txt_RightCaveAngle.Enabled = false;
            }
            else
            {
                this.btn_ProfileCalculate.Enabled = false;
                this.txt_LeftCulverLength.Enabled = true;
                this.txt_RightCulverLength.Enabled = true;
                this.txt_LeftCaveAngle.Enabled = true;
                this.txt_RightCaveAngle.Enabled = true;
            }
        }

        private void btn_save_Click(object sender, EventArgs e)
        {
            string jsonSave = "";
            try
            {
                jsonSave = JsonConvert.SerializeObject(CommonData.Instance);
            }
            catch (Exception ex)
            {

            }

            if (CommonData.Instance.CommomTotal.SelectLine != null)
            {
                SetElementEc(CommonData.Instance.CommomTotal.SelectLine, jsonSave);
            }
        }

        /// <summary>
        /// 设置涵洞交线EC
        /// </summary>
        /// <param name="element"></param>
        /// <param name="jsonSave"></param>
        private static void SetElementEc(Bentley.DgnPlatformNET.Elements.Element element, string jsonSave)
        {
            Bentley.DgnPlatformNET.ItemTypeLibrary itemTypeLibrary = ItemTypeHelpers.NewTypeLibrary("涵洞");
            Bentley.DgnPlatformNET.ItemType itemType = ItemTypeHelpers.NewItemType(itemTypeLibrary, "涵洞线");
            CustomProperty customProperty = ItemTypeHelpers.NewPropertyType(itemType, "涵洞信息", CustomProperty.TypeKind.String, false, true);
            CustomProperty customProperty2 = ItemTypeHelpers.NewPropertyType(itemType, "涵洞类型", CustomProperty.TypeKind.String, false, true);

            PrefabricateNomalSlabCulvert4m.uitl.refSoiled.BodyProperty.AttachItemToElement(element, "涵洞", "涵洞线", "涵洞类型", CustomProperty.TypeKind.String, "盖板涵");
            SetCoverCulvertECProperty.AttachItemToElement(element, "涵洞", "涵洞线", "涵洞信息", CustomProperty.TypeKind.String, jsonSave);
        }


        /// <summary>
        /// 获取涵洞交线EC
        /// </summary>
        /// <param name="element"></param>
        /// <returns></returns>
        private static string GetElementEc(Element element, out string type)
        {
            string typeString = "";
            string result = "";
            List<IDgnECInstance> dgnECInstances = ItemTypeHelpers.GetECInstanceFromElement(element);
            foreach (var item in dgnECInstances)
            {
                if (item.ClassDefinition.InvariantDisplayLabel == "涵洞线")
                {
                    foreach (var item2 in item)
                    {
                        string displayLabel = item2.Property.DisplayLabel;
                        if (displayLabel == "涵洞信息")
                        {
                            result = item2.StringValue;
                        }
                        else if (displayLabel == "涵洞类型")
                        {
                            typeString = item2.StringValue;
                        }
                    }
                }
            }
            type = typeString;
            return result;
        }


        private void SetBindingDatas(CommonData commonData)
        {
            tempSwitch = false;

            #region 总体
            this.cmb_StandardDrawing.Text = CommonData.Instance.CommomTotal.GeneralDiagram.ToString();
            //涵洞填土高度
            this.txt_Fill.Text = CommonData.Instance.CommomTotal.FillValue.ToString();
            this.txt_FillLeft.Text = CommonData.Instance.CommomTotal.LeftFillValue.ToString();
            this.txt_FillRight.Text = CommonData.Instance.CommomTotal.RightFillValue.ToString();
            this.txt_CulvertBaseHeight.Text = CommonData.Instance.CommomTotal.Elevation.ToString();
            this.txt_CulvertBaseSlope.Text = CommonData.Instance.CommomTotal.Slope.ToString();
            #endregion

            #region 界面绑定
            #region 帽石
            //左帽石
            this.txt_LeftCapStoneWidth.Text = CommonData.Instance.CapStone.CapStoneLeft.ToString();
            this.txt_LeftCapStoneChamfering.Text = CommonData.Instance.CapStone.CapStoneLeft.ToString();
            this.txt_LeftCapStoneHeight.Text = CommonData.Instance.CapStone.CapStoneLeft.ToString();
            this.txt_LeftCapStoneOutQuantity.Text = CommonData.Instance.CapStone.CapStoneLeft.ToString();
            this.txt_LeftCapStoneMaterial.Text = CommonData.Instance.CapStone.CapStoneLeft.ToString();
            //右帽石
            this.txt_RightCapStoneWidth.Text = CommonData.Instance.CapStone.CapStoneRight.ToString();
            this.txt_RightCapStoneChamfering.Text = CommonData.Instance.CapStone.CapStoneRight.ToString();
            this.txt_RightCapStoneHeight.Text = CommonData.Instance.CapStone.CapStoneRight.ToString();
            this.txt_RightCapStoneOutQuantity.Text = CommonData.Instance.CapStone.CapStoneRight.ToString();
            this.txt_RightCapStoneMaterial.Text = CommonData.Instance.CapStone.CapStoneRight.ToString();
            #endregion
            #region 端墙
            //左侧参数
            this.cmb_LeftEndWallBackSlope.Text = CommonData.Instance.EndWall.EndWallLeft.ToString();
            this.cmb_LeftEndWallBaseBurialDepth.Text = CommonData.Instance.EndWall.EndWallLeft.ToString();
            this.txt_LeftEndWallHeight.Text = CommonData.Instance.EndWall.EndWallLeft.ToString();
            this.txt_LeftEndWallBaseNumberOfPlies.Text = CommonData.Instance.EndWall.EndWallLeft.ToString();
            this.txt_LeftEndWallBaseHeight.Text = CommonData.Instance.EndWall.EndWallLeft.ToString();
            this.txt_LeftEndWallWidth.Text = CommonData.Instance.EndWall.EndWallLeft.ToString();
            this.txt_LeftEndWallOverhang.Text = CommonData.Instance.EndWall.EndWallLeft.ToString();
            this.txt_LeftEndWallEdgeIns.Text = CommonData.Instance.EndWall.EndWallLeft.ToString();
            this.txt_LeftEndWallEdgeOut.Text = CommonData.Instance.EndWall.EndWallLeft.ToString();
            this.txt_LeftEndWallOneMaterial.Text = CommonData.Instance.EndWall.EndWallLeft.ToString();
            //右侧参数
            this.cmb_RightEndWallBackSlope.Text = CommonData.Instance.EndWall.EndWallRight.ToString();
            this.cmb_RightEndWallBaseBurialDepth.Text = CommonData.Instance.EndWall.EndWallRight.ToString();
            this.txt_RightEndWallHeight.Text = CommonData.Instance.EndWall.EndWallRight.ToString();
            this.txt_RightEndWallBaseNumberOfPlies.Text = CommonData.Instance.EndWall.EndWallRight.ToString();
            this.txt_RightEndWallBaseHeight.Text = CommonData.Instance.EndWall.EndWallRight.ToString();
            this.txt_RightEndWallWidth.Text = CommonData.Instance.EndWall.EndWallRight.ToString();
            this.txt_RightEndWallOverhang.Text = CommonData.Instance.EndWall.EndWallRight.ToString();
            this.txt_RightEndWallEdgeIns.Text = CommonData.Instance.EndWall.EndWallRight.ToString();
            this.txt_RightEndWallEdgeOut.Text = CommonData.Instance.EndWall.EndWallRight.ToString();
            this.txt_RightEndWallOneMaterial.Text = CommonData.Instance.EndWall.EndWallRight.ToString();
            #endregion
            #region 八字墙 
            //左洞口
            this.cmb_LeftAliformWallInsideEdge.Text = CommonData.Instance.AliformWall.AliformWallLeft.ToString();
            this.cmb_LeftAliformWallBurialDepth.Text = CommonData.Instance.AliformWall.AliformWallLeft.ToString();
            this.txt_LeftAliformWallPaveLengthen.Text = CommonData.Instance.AliformWall.AliformWallLeft.ToString();
            this.txt_LeftAliformWallOutsideEdge.Text = CommonData.Instance.AliformWall.AliformWallLeft.ToString();
            this.txt_LeftAliformWallVerticalWidth.Text = CommonData.Instance.AliformWall.AliformWallLeft.ToString();
            this.txt_LeftAliformWallMinCrossProfileHeight.Text = CommonData.Instance.AliformWall.AliformWallLeft.ToString();
            this.txt_LeftAliformWallBaseThickness.Text = CommonData.Instance.AliformWall.AliformWallLeft.ToString();
            this.txt_LeftAliformWallCutoffWallHeight.Text = CommonData.Instance.AliformWall.AliformWallLeft.ToString();
            this.txt_LeftAliformWallPaveThickness.Text = CommonData.Instance.AliformWall.AliformWallLeft.ToString();
            this.txt_LeftAliformWallObeyAngle.Text = CommonData.Instance.AliformWall.AliformWallLeft.ToString();
            this.txt_LeftAliformWallContraryAngle.Text = CommonData.Instance.AliformWall.AliformWallLeft.ToString();
            this.txt_LeftAliformWallCarryingCapacity.Text = CommonData.Instance.AliformWall.AliformWallLeft.ToString();
            this.txt_LeftAliformWallVerticalBackSlope.Text = CommonData.Instance.AliformWall.AliformWallLeft.ToString();
            this.cmb_LeftAliformWallInEdge.Text = CommonData.Instance.AliformWall.AliformWallLeft.ToString();
            this.txt_LeftAliformWallPaveSlope.Text = CommonData.Instance.AliformWall.AliformWallLeft.ToString();
            this.txt_LeftAliformWallCutoffWallThickness.Text = CommonData.Instance.AliformWall.AliformWallLeft.ToString();
            //右洞口
            this.cmb_RightAliformWallInsideEdge.Text = CommonData.Instance.AliformWall.AliformWallRight.ToString();
            this.cmb_RightAliformWallBurialDepth.Text = CommonData.Instance.AliformWall.AliformWallRight.ToString();
            this.txt_RightAliformWallPaveLengthen.Text = CommonData.Instance.AliformWall.AliformWallRight.ToString();
            this.txt_RightAliformWallOutsideEdge.Text = CommonData.Instance.AliformWall.AliformWallRight.ToString();
            this.txt_RightAliformWallVerticalWidth.Text = CommonData.Instance.AliformWall.AliformWallRight.ToString();
            this.txt_RightAliformWallMinCrossProfileHeight.Text = CommonData.Instance.AliformWall.AliformWallRight.ToString();
            this.txt_RightAliformWallBaseThickness.Text = CommonData.Instance.AliformWall.AliformWallRight.ToString();
            this.txt_RightAliformWallCutoffWallHeight.Text = CommonData.Instance.AliformWall.AliformWallRight.ToString();
            this.txt_RightAliformWallPaveThickness.Text = CommonData.Instance.AliformWall.AliformWallRight.ToString();
            this.txt_RightAliformWallObeyAngle.Text = CommonData.Instance.AliformWall.AliformWallRight.ToString();
            this.txt_RightAliformWallContraryAngle.Text = CommonData.Instance.AliformWall.AliformWallRight.ToString();
            this.txt_RightAliformWallCarryingCapacity.Text = CommonData.Instance.AliformWall.AliformWallRight.ToString();
            this.txt_RightAliformWallVerticalBackSlope.Text = CommonData.Instance.AliformWall.AliformWallRight.ToString();
            this.cmb_RightAliformWallInEdge.Text = CommonData.Instance.AliformWall.AliformWallRight.ToString();
            this.txt_RightAliformWallPaveSlope.Text = CommonData.Instance.AliformWall.AliformWallRight.ToString();
            this.txt_RightAliformWallCutoffWallThickness.Text = CommonData.Instance.AliformWall.AliformWallRight.ToString();

            #endregion
            #region 锥坡
            /*
             * 左侧锥坡
             */
            //截水墙高(含铺.Text = CommonData.Instance.ConicalSlope.ConicalSlopeL., .ToString();
            //洞口铺砌厚度
            this.txt_LeftPavingThickness.Text = CommonData.Instance.ConicalSlope.ConicalSlopeLeft.ToString();
            //截水墙厚度
            this.txt_LeftWallThickness.Text = CommonData.Instance.ConicalSlope.ConicalSlopeLeft.ToString();
            this.cmb_LeftSectionSlopeRatio.Text = CommonData.Instance.ConicalSlope.ConicalSlopeLeft.ToString();
            this.cmb_LeftBaseDepth.Text = CommonData.Instance.ConicalSlope.ConicalSlopeLeft.ToString();
            this.cmb_LeftMedialFlank.Text = CommonData.Instance.ConicalSlope.ConicalSlopeLeft.ToString();
            this.txt_LeftPavingLengthened.Text = CommonData.Instance.ConicalSlope.ConicalSlopeLeft.ToString();
            this.txt_LeftPavingSlope.Text = CommonData.Instance.ConicalSlope.ConicalSlopeLeft.ToString();


            /*
             * 右侧锥坡
             */
            //截水墙高(含铺.Text = CommonData.Instance.ConicalSlope.ConicalSlopeRi., .ToString();
            //洞口铺砌厚度
            this.txt_RightPavingThickness.Text = CommonData.Instance.ConicalSlope.ConicalSlopeRight.ToString();
            //截水墙厚度
            this.txt_RightWallThickness.Text = CommonData.Instance.ConicalSlope.ConicalSlopeRight.ToString();
            this.cmb_RightSectionSlopeRatio.Text = CommonData.Instance.ConicalSlope.ConicalSlopeRight.ToString();
            this.cmb_RightBaseDepth.Text = CommonData.Instance.ConicalSlope.ConicalSlopeRight.ToString();
            this.cmb_RightMedialFlank.Text = CommonData.Instance.ConicalSlope.ConicalSlopeRight.ToString();
            this.txt_RightPavingLengthened.Text = CommonData.Instance.ConicalSlope.ConicalSlopeRight.ToString();
            this.txt_RightPavingSlope.Text = CommonData.Instance.ConicalSlope.ConicalSlopeRight.ToString();

            //左右锥坡坡面比
            this.cmb_OverallSlopeRatioLeft.Text = CommonData.Instance.ConicalSlope.ConicalSlopeLeft.ToString();
            this.cmb_OverallSlopeRatioRight.Text = CommonData.Instance.ConicalSlope.ConicalSlopeRight.ToString();
            //左右锥坡基础深度
            this.cmb_OverallBaseDepthLeft.Text = CommonData.Instance.ConicalSlope.ConicalSlopeLeft.ToString();
            this.cmb_OverallBaseDepthRight.Text = CommonData.Instance.ConicalSlope.ConicalSlopeRight.ToString();
            #endregion
            #endregion
            tempSwitch = true;
        }

        public void ProfileCalculate()
        {
            btn_ProfileCalculate_Click(null, null);
        }

        private void btn_ProfileCalculate_Click(object sender, EventArgs e)
        {
            IObjectSpace objectSpase = RepositoryConnectionManager.Instance.GetActive().ObjectSpace;
            Bentley.CifNET.GeometryModel.GeometricModel geometricModel = Bentley.CifNET.GeometryModel.GeometricModel.GetGeometricModel(objectSpase, GetModelOptions.AllowDoNotExist);

            //ConsensusConnectionEdit con = ConsensusConnectionEdit.GetActive();
            //Bentley.CifNET.GeometryModel.SDK.GeometricModel gm = con.GetActiveGeometricModel();
            LinearEntity2dInPlan mainLinear = ORDHelp.GetAllAlignmentsInModel(geometricModel).Find(p => p.Name == CommonData.Instance.CommomTotal.SelectAlignments[0].ThisAlignment.Name &&
                p.Geometry.StartPoint.Coordinates == CommonData.Instance.CommomTotal.SelectAlignments[0].ThisAlignment.LinearGeometry.StartPoint.Coordinates &&
                p.Geometry.EndPoint.Coordinates == CommonData.Instance.CommomTotal.SelectAlignments[0].ThisAlignment.LinearGeometry.EndPoint.Coordinates);


            List<Bentley.CifNET.GeometryModel.LinearEntity2dInPlan> linearEntity2dInPlans = new List<Bentley.CifNET.GeometryModel.LinearEntity2dInPlan>();
            for (int i = 0; i < CommonData.Instance.CommomTotal.SelectAlignments.Count; i++)
            {
                if (i == 0) continue;
                linearEntity2dInPlans.Add(ORDHelp.GetAllAlignmentsInModel(geometricModel).Find(p => p.Name == CommonData.Instance.CommomTotal.SelectAlignments[i].ThisAlignment.Name &&
                    p.Geometry.StartPoint.Coordinates == CommonData.Instance.CommomTotal.SelectAlignments[i].ThisAlignment.LinearGeometry.StartPoint.Coordinates &&
                    p.Geometry.EndPoint.Coordinates == CommonData.Instance.CommomTotal.SelectAlignments[i].ThisAlignment.LinearGeometry.EndPoint.Coordinates));
            }

            double clearHeight = Convert.ToDouble(CommonData.Instance.CommomTotal.ClearSpanHeadroom.Split('×')[1].Trim());
            double piecePlyHeight = this.cmb_BasicsType.Text == "整体式" ? Convert.ToDouble(this.txt_UnitaryPiecePly.Text) * 0.01 : Convert.ToDouble(this.txt_SeparatingPiecePly.Text) * 0.01;
            //获取涵洞布置线与边坡交点信息
            ProfileCalculate profileCalculate = new ProfileCalculate(
                objectSpase,
                mainLinear,
                linearEntity2dInPlans,
                ORDHelp.GetAllAlignmentsInModel(geometricModel).Find(p => p.Name == CommonData.Instance.CulverIntersectingLine.Name &&
                    p.Geometry.StartPoint.Coordinates == CommonData.Instance.CulverIntersectingLine.LinearGeometry.StartPoint.Coordinates &&
                    p.Geometry.EndPoint.Coordinates == CommonData.Instance.CulverIntersectingLine.LinearGeometry.EndPoint.Coordinates),
                5.0,
                CommonData.Instance.CommomTotal.Slope
                );
            (double slope, double elevation) data = profileCalculate.CalculateResultData(clearHeight + piecePlyHeight);
            if (data.slope < 0)
            {
                if (data.slope > -0.003) data.slope = -0.003;
            }
            else
            {
                if (data.slope < 0.003) data.slope = 0.003;
            }
            tempSwitch = false;
            CommonData.Instance.CommomTotal.Slope = Math.Round(data.slope * 100.0, 4);
            tempSwitch = true;
            CommonData.Instance.CommomTotal.Elevation = Math.Round(data.elevation, 4);
            isAlter = true;
            txt_CulvertBaseHeight_Leave(null, null);
        }

        #region 边沟跌水井是否自动计算井深
        private void cb_AutoLeft_CheckedChanged(object sender, EventArgs e)
        {
            if (cb_AutoLeft.Checked == true)
            {
                txt_SideDitchFallWellLeft_ShaftDeep.ReadOnly = true;
                txt_SideDitchFallWellLeft_ShaftDeep.BackColor = System.Drawing.Color.Gray;

                txt_SideDitchFallWellLeft_ShaftDeep.Text =
                    (
                    Convert.ToDouble(cmb_ClearSpanAndHeight.Text.Split('×')[1]) * 100 +
                    Convert.ToDouble(txt_PointPly.Text) +
                    Convert.ToDouble(txt_SideDitchFallWellLeft_GritBasinDeep.Text)
                    ).ToString();
            }
            else
            {
                txt_SideDitchFallWellLeft_ShaftDeep.ReadOnly = false;
                txt_SideDitchFallWellLeft_ShaftDeep.BackColor = System.Drawing.Color.White;
            }
        }

        private void cb_AutoRight_CheckedChanged(object sender, EventArgs e)
        {
            if (cb_AutoRight.Checked == true)
            {
                txt_SideDitchFallWellRight_ShaftDeep.ReadOnly = true;
                txt_SideDitchFallWellRight_ShaftDeep.BackColor = System.Drawing.Color.Gray;

                txt_SideDitchFallWellRight_ShaftDeep.Text =
                    (
                    Convert.ToDouble(cmb_ClearSpanAndHeight.Text.Split('×')[1]) * 100 +
                    Convert.ToDouble(txt_PointPly.Text) +
                    Convert.ToDouble(txt_SideDitchFallWellLeft_GritBasinDeep.Text)
                    ).ToString();
            }
            else
            {
                txt_SideDitchFallWellRight_ShaftDeep.ReadOnly = false;
                txt_SideDitchFallWellRight_ShaftDeep.BackColor = System.Drawing.Color.White;
            }
        }

        /// <summary>
        /// 净高发生变化时, 并且勾选自动选择, 需要重新计算边沟跌水井的井深
        /// </summary>
        public void WellDepth()
        {
            if (cb_AutoLeft.Checked == true)
                txt_SideDitchFallWellLeft_ShaftDeep.Text =
                (
                Convert.ToDouble(cmb_ClearSpanAndHeight.Text.Split('×')[1]) * 100 +
                Convert.ToDouble(txt_PointPly.Text) +
                Convert.ToDouble(txt_SideDitchFallWellLeft_GritBasinDeep.Text)
                ).ToString();

            if (cb_AutoRight.Checked == true)
                txt_SideDitchFallWellRight_ShaftDeep.Text =
                (
                Convert.ToDouble(cmb_ClearSpanAndHeight.Text.Split('×')[1]) * 100 +
                Convert.ToDouble(txt_PointPly.Text) +
                Convert.ToDouble(txt_SideDitchFallWellLeft_GritBasinDeep.Text)
                ).ToString();


        }

        #endregion

        #region 铺装加减行

        private void AddRowMenuItem_Click(object sender, EventArgs e)
        {
            int index = 0;
            if (dgv_MatFormation.CurrentCell != null && dgv_MatFormation.CurrentCell.RowIndex != dgv_MatFormation.RowCount - 1)
            {
                index = dgv_MatFormation.CurrentCell.RowIndex;
                index += 1;
                dgv_MatFormation.Rows.Insert(index);
            }
            else
            {
                dgv_MatFormation.Rows.Add();
                index = dgv_MatFormation.RowCount - 1;
            }

            dgv_MatFormation[1, index].Value = 50;
            dgv_MatFormation[3, index].Value = 0.02;

            for (int i = 0; i < dgv_MatFormation.RowCount; i++)
                dgv_MatFormation[0, i].Value = i + 1;

        }

        private void DeleteRowMenuItem_Click(object sender, EventArgs e)
        {
            if (dgv_MatFormation.RowCount == 0) return;

            int index = dgv_MatFormation.CurrentCell.RowIndex;
            dgv_MatFormation.Rows.RemoveAt(index);

            for (int i = 0; i < dgv_MatFormation.RowCount; i++)
                dgv_MatFormation[0, i].Value = i + 1;
        }

        #endregion

        private void btn_SchematicDiagram_Click(object sender, EventArgs e)
        {
            AislePic aislePic = new AislePic();
            aislePic.ShowDialog();
        }
        bool isOk = false;
        private void cbx_isUse_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (isOk)
            {
                if (cbx_isUse.SelectedIndex == 0)
                {
                    tempSwitch = true;

                    SetDropDownIsList(cmb_StandardDrawing);
                    SetDropDownIsList(cmb_ClearSpanAndHeight);

                    //SetDropDownIsList(cmb_OverallInsideDiameter);
                    //SetDropDownIsList(cmb_SubcrustBaseAngle);
                    SetDropDownIsList(cmb_LeftEndWallBackSlope);
                    SetDropDownIsList(cmb_LeftEndWallBaseBurialDepth);
                    SetDropDownIsList(cmb_RightEndWallBackSlope);
                    SetDropDownIsList(cmb_RightEndWallBaseBurialDepth);
                    SetDropDownIsList(cmb_LeftAliformWallInsideEdge);
                    SetDropDownIsList(cmb_LeftAliformWallBurialDepth);
                    SetDropDownIsList(cmb_LeftAliformWallInEdge);
                    SetDropDownIsList(cmb_RightAliformWallInsideEdge);
                    SetDropDownIsList(cmb_RightAliformWallBurialDepth);
                    SetDropDownIsList(cmb_RightAliformWallInEdge);
                    SetDropDownIsList(cmb_LeftSectionSlopeRatio);
                    SetDropDownIsList(cmb_LeftBaseDepth);
                    SetDropDownIsList(cmb_LeftMedialFlank);
                    SetDropDownIsList(cmb_RightSectionSlopeRatio);
                    SetDropDownIsList(cmb_RightBaseDepth);
                    SetDropDownIsList(cmb_RightMedialFlank);
                    SetDropDownIsList(cmb_ExchangeFillMaterial);
                    GetDBCulvertData();
                }
                else
                {
                    tempSwitch = false;
                    SetDropDown(cmb_StandardDrawing);
                    SetDropDown(cmb_ClearSpanAndHeight);
                    SetDropDown(cmb_LeftEndWallBackSlope);
                    SetDropDown(cmb_LeftEndWallBaseBurialDepth);
                    SetDropDown(cmb_RightEndWallBackSlope);
                    SetDropDown(cmb_RightEndWallBaseBurialDepth);
                    SetDropDown(cmb_LeftAliformWallInsideEdge);
                    SetDropDown(cmb_LeftAliformWallBurialDepth);
                    SetDropDown(cmb_LeftAliformWallInEdge);
                    SetDropDown(cmb_RightAliformWallInsideEdge);
                    SetDropDown(cmb_RightAliformWallBurialDepth);
                    SetDropDown(cmb_RightAliformWallInEdge);
                    SetDropDown(cmb_LeftSectionSlopeRatio);
                    SetDropDown(cmb_LeftBaseDepth);
                    SetDropDown(cmb_LeftMedialFlank);
                    SetDropDown(cmb_RightSectionSlopeRatio);
                    SetDropDown(cmb_RightBaseDepth);
                    SetDropDown(cmb_RightMedialFlank);
                    SetDropDown(cmb_ExchangeFillMaterial);
                }

                txt_Length.Enabled = !tempSwitch;
                txt_width.Enabled = !tempSwitch;
                txt_PointPly.Enabled = !tempSwitch;
                txt_MidSpanPly.Enabled = !tempSwitch;
                txt_LeftLength.Enabled = !tempSwitch;
                txt_LeftShortLength.Enabled = !tempSwitch;
                txt_LeftLongLength.Enabled = !tempSwitch;
                txt_LeftCoverplatePly.Enabled = !tempSwitch;
                txt_RightLength.Enabled = !tempSwitch;
                txt_RightShortLength.Enabled = !tempSwitch;
                txt_RightLongLength.Enabled = !tempSwitch;
                txt_RightCoverplatePly.Enabled = !tempSwitch;

                txt_UnitaryPiecePly.Enabled = !tempSwitch;
                txt_UnitaryBasics.Enabled = !tempSwitch;
                txt_UnitaryStandPly.Enabled = !tempSwitch;
                txt_UnitaryStandTopWidth.Enabled = !tempSwitch;
                txt_UnitaryBottomChamfer.Enabled = !tempSwitch;
                txt_UnitaryBasicsPly.Enabled = !tempSwitch;
                txt_UnitaryBearing.Enabled = !tempSwitch;
                txt_SeparatingPiecePly.Enabled = !tempSwitch;
                txt_SeparatingBasics.Enabled = !tempSwitch;
                txt_SeparatingStandPly.Enabled = !tempSwitch;
                txt_SeparatingBasicWidth.Enabled = !tempSwitch;
                txt_SeparatingStandTopWidth.Enabled = !tempSwitch;
                txt_SeparatingBasicsPly.Enabled = !tempSwitch;
                txt_SeparatingBearing.Enabled = !tempSwitch;

                txt_LeftCapStoneWidth.Enabled = !tempSwitch;
                txt_LeftCapStoneChamfering.Enabled = !tempSwitch;
                txt_LeftCapStoneHeight.Enabled = !tempSwitch;
                txt_LeftCapStoneOutQuantity.Enabled = !tempSwitch;
                txt_LeftCapStoneMaterial.Enabled = !tempSwitch;
                txt_RightCapStoneWidth.Enabled = !tempSwitch;
                txt_RightCapStoneChamfering.Enabled = !tempSwitch;
                txt_RightCapStoneHeight.Enabled = !tempSwitch;
                txt_RightCapStoneOutQuantity.Enabled = !tempSwitch;
                txt_RightCapStoneMaterial.Enabled = !tempSwitch;

                txt_LeftEndWallHeight.Enabled = !tempSwitch;
                txt_LeftEndWallBaseNumberOfPlies.Enabled = !tempSwitch;
                txt_LeftEndWallBaseHeight.Enabled = !tempSwitch;
                txt_LeftEndWallWidth.Enabled = !tempSwitch;
                txt_LeftEndWallOverhang.Enabled = !tempSwitch;
                txt_LeftEndWallEdgeIns.Enabled = !tempSwitch;
                txt_LeftEndWallEdgeOut.Enabled = !tempSwitch;
                txt_LeftEndWallOneMaterial.Enabled = !tempSwitch;
                txt_RightEndWallHeight.Enabled = !tempSwitch;
                txt_RightEndWallBaseNumberOfPlies.Enabled = !tempSwitch;
                txt_RightEndWallBaseHeight.Enabled = !tempSwitch;
                txt_RightEndWallWidth.Enabled = !tempSwitch;
                txt_RightEndWallOverhang.Enabled = !tempSwitch;
                txt_RightEndWallEdgeIns.Enabled = !tempSwitch;
                txt_RightEndWallEdgeOut.Enabled = !tempSwitch;
                txt_RightEndWallOneMaterial.Enabled = !tempSwitch;

                txt_LeftAliformWallOutsideEdge.Enabled = !tempSwitch;
                txt_LeftAliformWallVerticalWidth.Enabled = !tempSwitch;
                txt_LeftAliformWallMinCrossProfileHeight.Enabled = !tempSwitch;
                txt_LeftAliformWallBaseThickness.Enabled = !tempSwitch;
                txt_LeftAliformWallCutoffWallHeight.Enabled = !tempSwitch;
                txt_LeftAliformWallCutoffWallThickness.Enabled = !tempSwitch;
                txt_LeftAliformWallPaveThickness.Enabled = !tempSwitch;
                txt_LeftAliformWallCarryingCapacity.Enabled = !tempSwitch;
                txt_LeftAliformWallVerticalBackSlope.Enabled = !tempSwitch;
                txt_LeftAliformWallObeyAngle.Enabled = !tempSwitch;
                txt_LeftAliformWallContraryAngle.Enabled = !tempSwitch;
                txt_RightAliformWallOutsideEdge.Enabled = !tempSwitch;
                txt_RightAliformWallVerticalWidth.Enabled = !tempSwitch;
                txt_RightAliformWallMinCrossProfileHeight.Enabled = !tempSwitch;
                txt_RightAliformWallBaseThickness.Enabled = !tempSwitch;
                txt_RightAliformWallCutoffWallHeight.Enabled = !tempSwitch;
                txt_RightAliformWallCutoffWallThickness.Enabled = !tempSwitch;
                txt_RightAliformWallPaveThickness.Enabled = !tempSwitch;
                txt_RightAliformWallCarryingCapacity.Enabled = !tempSwitch;
                txt_RightAliformWallVerticalBackSlope.Enabled = !tempSwitch;
                txt_RightAliformWallObeyAngle.Enabled = !tempSwitch;
                txt_RightAliformWallContraryAngle.Enabled = !tempSwitch;

                txt_LeftWaterWallHeight.Enabled = !tempSwitch;
                txt_LeftPavingThickness.Enabled = !tempSwitch;
                txt_LeftWallThickness.Enabled = !tempSwitch;
                txt_RightWaterWallHeight.Enabled = !tempSwitch;
                txt_RightPavingThickness.Enabled = !tempSwitch;
                txt_RightWallThickness.Enabled = !tempSwitch;

            }
        }
        /// <summary>
        /// 设置combobox控件为dropDown
        /// </summary>
        /// <param name="comboBox"></param>
        void SetDropDown(ComboBox comboBox)
        {
            comboBox.DropDownStyle = ComboBoxStyle.DropDown;
        }
        /// <summary>
        /// 设置combobox控件为dropDownList
        /// </summary>
        /// <param name="comboBox"></param>
        void SetDropDownIsList(ComboBox comboBox)
        {
            comboBox.DropDownStyle = ComboBoxStyle.DropDownList;
        }
    }
}
